/ Published in: MXML
Quick example of how to implement a fun Drag n' Drop using Flex List Component
Expand |
Embed | Plain Text
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var listDP1:ArrayCollection = new ArrayCollection([ { label: "Jeff", data: 1 }, { label: "John", data: 2 }, { label: "Ryan", data: 3 }, ]); [Bindable] private var listDP2: ArrayCollection = new ArrayCollection(); private function doNothing():void { } ]]> </mx:Script> <!-- Drag n Drop Properties A. dragEnabled -> Boolean. Let's you drag out of this control B. dropEnabled -> Boolean. Lets you drop items into this control C. dragMoveEnabled -> Boolean. Let's you move (rather than copy) items from one control to another --> <mx:HBox width="100%" height="100%"> <mx:List id="list1" dataProvider="{listDP1}" width="50%" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" /> <mx:Spacer width="2" /> <mx:List id="list2" dataProvider="{listDP2}" width="50%" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" /> </mx:HBox> <mx:Button label="Debug" click="doNothing()" y="200" /> </mx:Application>
You need to login to post a comment.
