Home Tutorial Flex Flex-components Two way drag and drop in Flex`

 
 

Two way drag and drop in Flex`
Posted on: March 12, 2010 at 12:00 AM
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:-

 

Related Tags for Two way drag and drop in Flex`:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.