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;
& ......
flexÖÐʹÓÃsocketÓëÆäËûÓïÑÔ(ÈçJava)socket½»»¥µÄÀý×Ó¡£
×Ô´ÓAdobe Flash PlayerÉý¼¶µ½9.0.124ºó£¬ÓÉÓÚ°²È«²ßÂÔµÄÐ޸ģ¬ÔÀ´µÄsocketÁ¬½Ó·½Ê½½«²»Äܱ»Ê¹Ó㬶ø±ØÐë²ÉÓÃÐµİ²È«²ßÂÔ·½Ê½À´ÑéÖ¤£¬¾ßÌåµÄ¹ý³ÌÈçÏ£º
1.Ê×Ïȼì²â·þÎñ¶ËµÄ843¶Ë¿ÚÊÇ·ñÌṩ°²È«²ßÂÔÎļþ£»
&n ......
ÕâÊÇÒ»¸ö¼òµ¥µÄ¹¤×÷Á÷Éè¼ÆÆ÷Ä£ÐÍ£¬»¹²»ÄÜÓÃÓÚʵ¼ÊÏîÄ¿£¬Ö»ÊǸöÈËÐËȤ×öһЩ¼¼ÊõѧϰÓë³¢ÊÔ¡£Éè¼ÆÆ÷Ö§³ÖһЩ¹¤×÷Á÷»ù±¾×é¼þµÄ»æÖÆ£¬Èç½Úµã¡¢Â·ÓÉÏß·µÈµÈ¡£
Õû¸öÉè¼ÆÆ÷ÊÇ´¿Flex¼¼ÊõʵÏÖ£¬Î´ÓëÊý¾Ý¿â½Ó¿Ú¡£²ÉÓÃFlex Builder 3.0¿ª·¢£¬Í¨¹ýʵ¼ù¶ÔFlexÒÔϼ¼ÊõÓÐÁ˸ü½øÒ» ......
¹Ø¼ü×Ö: flex, arraycollection
¼¯ºÏÊÇActionScript Öй¦ÄÜÇ¿´óµÄ»ùÓÚË÷ÒýµÄÊý×é×é¼þ£¬Ìí¼ÓÁËÈç¶ÔÄÚÈݽøÐÐÅÅÐòµÈ¹¦ÄÜ£¬
²Ù×÷Êý×éµÄ¶ÁȡλÖ㬴´½¨¾¹ýÅÅÐòµÄÊý×éÊÓͼ¡£¼¯ºÏÒ²ÄÜ֪ͨÆäÈÎÒâʼþ¼àÌýÆ÷¼àÌýÆäÊý
¾ÝÊÇ·ñ¸Ä±ä£¬ÒÔ¼°ÈκÎÊý¾ÝÏî±»Ìí¼Óµ½Ô´Êý×éʱ¿ÉÖ´ÐÐ×Ô¶¨ÒåÂß¼¡£µ±Êý¾Ý¸Ä±äʱ¿É֪ͨÆä
¼àÌýÆ÷£¬ÕâÊǼ¯ºÏµÄй ......
¹Ø¼ü×Ö: flex, ÍÏקº¯Êý
Flex×é¼þÄÚÖÃÁË´¦ÀíÍÏקʼþµÄ½Ó¿Ú£¬ÓÐЩ¿Ø¼þÒѾʵÏÖÁËÍÏק¹¦ÄÜ£¬±ÈÈçList¡¢DataGrid¡¢Menu¡¢TileList¡¢Tree£¬ÔÚÉèÖÃÏà¹ØµÄÍÏקÊôÐÔºó£¬ËüÃǶ¼¿ÉÒÔÔÚÏàͬÀàÐ͵Ä×é¼þÖ®¼äÀûÓÃÊó±êÀ´ÊµÏÖÊý¾ÝµÄתÒÆ¡£
allowDragSelection ÊÇ·ñ¿ÉÒÔÍÏÑ¡
&n ......