header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Ramakrishna
Points:180
Posts:0

5/2/2010 10:40:33 PM

Title: drag and drop


Hi,
I have two list boxes, whenever i doubleclick or click the first list box element , it will moves to the other list box, and there is select all option is also there, So whenever select all option it will moves into other list box and vice versa. please provide any examples


Thanks & Regards,
K.V.Ramakrishna



1
Caldwell
Points: 0
Posts:0
5/3/2010 5:59:30 AM



hi you can see this example to add items from one list component to another on click. in this example the Item from first list component is removed and added to the next .Here is the source code for example:


<?xml version="1.0"?>
<!-- dpcontrols/ListLabelFunction.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
	<mx:Script><![CDATA[
		import mx.events.ListEvent;
		protected function list1_changeHandler(event:ListEvent):void
		{
			//add item to second list
			forList2.addItem(forList1.getItemAt(event.rowIndex));	
			//remove added item from list1 item to second list
			forList1.removeItemAt(event.rowIndex)
		}
	]]></mx:Script>
	
	<mx:ArrayCollection id="forList1">
		<mx:source>
			<mx:Object label=" Item one " data="Item one data"/>
			<mx:Object label=" Item two " data="Item two data"/>
			<mx:Object label=" Item three " data="Item three data"/>
		</mx:source>
	</mx:ArrayCollection>       
	<mx:ArrayCollection id="forList2">
	</mx:ArrayCollection>       
	<mx:List id="list1" dataProvider="{forList1}" change="list1_changeHandler(event)" />
	<mx:List id="list2" dataProvider="{forList2}" />
</mx:Application>


2
krishna
Points: 260
Posts:0
5/3/2010 9:40:34 PM



Hi,
Thanks for the reply, whenever I click All button , The list of all elements will move to other component, how to do that, please give me the reply

3
Justin
Points: 0
Posts:0
5/3/2010 10:29:55 PM



to add all items to the other list you can write the following code on a button click function. I have used the above code by Caldwell

forList2.source=forList1.toArray();
forList1.removeAll();

4
krishna
Points: 260
Posts:0
5/4/2010 3:25:29 AM



thanks for the replay


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 3+1 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions