FlexÍÏק CanvasÈÝÆ÷ÀïÍ϶¯Box
2009-02-18
ËõÂÔÏÔʾ
FlexÍÏק-CanvasÈÝÆ÷ÀïÍ϶¯Box
ÎÄÕ·ÖÀà:WebÇ°¶Ë¹Ø¼ü×Ö: flex, flexÍÏק, canvas, box
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.core.IUIComponent;
import mx.containers.Box;
import mx.containers.Canvas;
import mx.events.DragEvent;
import mx.managers.DragManager;
import mx.core.DragSource;
import mx.core.UIComponent;
private static const FORMAT:String = "box";
private function boxMouseDownHandler(evt:MouseEvent):void{
var iu:IUIComponent = evt.currentTarget as IUIComponent;
var dragSource:DragSource = new DragSource();
dragSource.addData( iu, FORMAT );
DragManager.doDrag( iu, dragSource, evt );
}
private function canvasDragEnterHandler(evt:DragEvent):void{
if(evt.dragSource.hasFormat(FORMAT)){
DragManager.acceptDragDrop(Canvas(evt.currentTarget));
}
}
private function canvasDragHandler(evt:DragEvent):void{
var box:Box = Box(evt.dragInitiator);
box.x = evt.localX;
box.y = evt.localY;
}
]]>
</mx:Script>
<mx:Canvas backgroundColor="0xEEEEEE" width="500" height="200" horizontalCenter="0" verticalCenter="0" dragEnter="canvasDragEnterHandler(event)" dragDrop="canvasDragHandler(event)">
<mx:Box width="20" height="20" backgroundColor="0x00FFCC" x="137" y="66" mouseDown="boxMouseDownHandler(event);"></mx:Box>
</mx:Canvas>
</mx:WindowedApplication>
µ±<mx:Box>·¢³ömouseDownʼþʱ£¬boxMouseDownHandler ·½·¨±»µ÷Óò¢ÇÒÍÏקԴÊý¾Ý±»Ôö¼Óµ½DragManager¡£
canvasDragEnterHandler¼ì²éÍÏקԴµÄ¸ñʽ
ÊÍ·ÅʱcanvasDragHandler·½·¨¸Ä±äÍÏקԴµÄλÖÃ
Ïà¹ØÎĵµ£º
»·¾³£ºeclipse 3.5 + tomcat 6.0 + flex builder 3.0 + blazeds-turnkey-3.2.0.3978.zip£¨adobeÍøÕ¾ÉÏÏÂÔØ£©
(ÒòΪ²»ÄܷŽØͼËùÒÔÖ»ÄÜÐðÊöÁË)
1£¬Ð½¨Ò»¸öjava webÏîÄ¿ ÀýÃûΪ :testjava;
2,Ôڴ˹¤³ÌÖÐдһ¸ö¼òµ¥µÄÀà:
package cn.com;
& ......
//»ñµÃÆÁÄ»µÄ·Ö±æÂÊ
var
x:Number=Capabilities.screenResolutionX;
var
y:Number=Capabilities.screenResolutionY;
Alert.show(
"x="
+x+
"y="
+y);
µÚ¶þÖÖ·½·¨
Alert.show(stage.fullScreenWidth+
"=="
+stage.fullScreenHeight);
//»ñµÃstage£¨¹¤×÷Çø£ ......
effects\Blinds.as
JScript code
package effects
{
import effects.effectClasses.BlindsInstance;
import mx.controls.scrollClasses.ScrollBarDirection;
import mx.effects.IEffectInstance;
  ......
flexÖÐʹÓÃsocketÓëÆäËûÓïÑÔ(ÈçJava)socket½»»¥µÄÀý×Ó¡£
×Ô´ÓAdobe Flash PlayerÉý¼¶µ½9.0.124ºó£¬ÓÉÓÚ°²È«²ßÂÔµÄÐ޸ģ¬ÔÀ´µÄsocketÁ¬½Ó·½Ê½½«²»Äܱ»Ê¹Ó㬶ø±ØÐë²ÉÓÃÐµİ²È«²ßÂÔ·½Ê½À´ÑéÖ¤£¬¾ßÌåµÄ¹ý³ÌÈçÏ£º
1.Ê×Ïȼì²â·þÎñ¶ËµÄ843¶Ë¿ÚÊÇ·ñÌṩ°²È«²ßÂÔÎļþ£»
&n ......
¹Ø¼ü×Ö: flex, ÍÏקº¯Êý
Flex×é¼þÄÚÖÃÁË´¦ÀíÍÏקʼþµÄ½Ó¿Ú£¬ÓÐЩ¿Ø¼þÒѾʵÏÖÁËÍÏק¹¦ÄÜ£¬±ÈÈçList¡¢DataGrid¡¢Menu¡¢TileList¡¢Tree£¬ÔÚÉèÖÃÏà¹ØµÄÍÏקÊôÐÔºó£¬ËüÃǶ¼¿ÉÒÔÔÚÏàͬÀàÐ͵Ä×é¼þÖ®¼äÀûÓÃÊó±êÀ´ÊµÏÖÊý¾ÝµÄתÒÆ¡£
allowDragSelection ÊÇ·ñ¿ÉÒÔÍÏÑ¡
&n ......