Share on Google+Share on Google+

Two way drag and drop in Flex`

Advertisement
In this tutorial you will get to know about two way drag and drop in Flex. Examples will illustrate the concept.

 

Flex Two Way Drag and Drop :-

In this tutorial you can see two way drag and drop for list based controls. In this example we can set dragEnabled="true" dragMoveEnabled="true" dropEnabled="true"  for both lists as you can see in this example.

Two-way Drag and Drop in Flex Example :-

<?xml version="1.0"?>

<!-- dragdrop\SimpleListToListMove.mxml -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();">

<mx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

private function initApp():void {

nameList.dataProvider = new ArrayCollection(['RK', 'BK', 'MK', 'AK', 'SK', 'JK']);

petNameList.dataProvider = new ArrayCollection([]);

}

]]>

</mx:Script>

<mx:HBox>

<mx:VBox>

<mx:Label text="Names List"/>

<mx:List id="nameList" allowMultipleSelection="true" dragEnabled="true"

dragMoveEnabled="true" dropEnabled="true" backgroundColor="yellow"/>

</mx:VBox>

<mx:VBox>

<mx:Label text="My Pet Name Is"/>

<mx:List id="petNameList" dropEnabled="true" dragMoveEnabled="true" dragEnabled="true" backgroundColor="yellow"/>

</mx:VBox>

</mx:HBox>

<mx:Button id="button1" label="Reset" click="initApp()"/>

</mx:Application>

Output:-

 

Advertisements

Posted on: March 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.