Also when tracing or alerting XML, ALWAYS use toXMLString() and not toString(). Search the archives if you want to understand why.
Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Friday, May 02, 2008 2:13 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Drag and Drop question If you don't define a dataprovider, an ArrayCollection will be used. In your case you want an XMLListCollection so you should initialize the second tree to have one. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rafael Faria Sent: Thursday, May 01, 2008 9:48 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Drag and Drop question So here is a example to what i'm talking about. someone can tell me why: 1 - First test on this example if i drag an item from a branch(NOT the WHOLE BRANCH) from tree1 and drop to tree2, and than click on "get elements from tree 2" button. it shows nothing... and if you keep adding elements it will show commas. How could i get the elements in the first place, and why it is showing the commas (apparently is behaving as an ArrayColletion but why? although this is not what i need to get... i need to get the elements). 2 - Second test If i drop the 2 branches that sits on the tree 1 and click to see what dataprovider is on tree2, it show the elements but in between the commas. i'm not sure what to do =/ someone help... what i need is to be able to drop fomr tree1 to tree2 and get an xml from tree2 with exactly the same structure that shows the elemnets. is this possible? <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " > <mx:Script> <![CDATA[ import mx.controls.Alert; ]]> </mx:Script> <mx:XML id="capitals"> <root> <Capitals label="U.S. State Capitals"> <capital label="AL" value="Montgomery"/> <capital label="AK" value="Juneau"/> <capital label="AR" value="Little Rock"/> <capital label="AZ" value="Phoenix"/> </Capitals> <Capitals label="Canadian Province Capitals"> <capital label="AB" value="Edmonton"/> <capital label="BC" value="Victoria"/> <capital label="MB" value="Winnipeg"/> <capital label="NB" value="Fredericton"/> </Capitals> </root> </mx:XML> <mx:HBox> <mx:Tree id="tree1" dataProvider="{capitals}" showRoot="false" labelField="@label" dragEnabled="true" dropEnabled="true" /> <mx:Tree id="tree2" showRoot="false" labelField="@label" dropEnabled="true" dragEnabled="true" /> </mx:HBox> <mx:Button click="Alert.show(tree1.dataProvider.toString())" label="Get Dataprovider tree 1" /> <mx:Button click="Alert.show(tree2.dataProvider.toString())" label="Get Dataprovider tree 2" /> </mx:Application>