[flexcoders] Re: List dragMoveEnabled problem?
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Can you post a test case? yep - here's the version that acts oddly. When I load the XML using mx:Model tags, everything works as expected. --start code-- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=init() mx:Script ![CDATA[ [Bindable] private var leftXML:XML; [Bindable] private var rightXML:XML; private function init():void{ var loadString:URLRequest = new URLRequest(file:///C:/TestListMoves/xml/lefthand.xml); var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE, doLeftLoaded); loader.load(loadString); } private function doLeftLoaded(event:Event):void{ leftXML = new XML(event.target.data); trace(leftXML); loadRight(); } private function loadRight():void{ var loadString:URLRequest = new URLRequest(file:///C:/TestListMoves/xml/righthand.xml); var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE, doRightLoaded); loader.load(loadString); } private function doRightLoaded(event:Event):void{ rightXML = new XML(event.target.data); trace(leftXML); } ]] /mx:Script mx:List x=97 y=135 id=leftList dataProvider={leftXML.item} height=409 dragEnabled=true dragMoveEnabled=true dropEnabled=true labelField=@name/mx:List mx:List x=379 y=135 id=rightList dataProvider={rightXML.item} height=409 dragEnabled=true dragMoveEnabled=true dropEnabled=true labelField=@name/mx:List mx:Button x=147 y=53 label=trace click=trace(leftList.dataProvider + quot;\nquot; + leftXML + '\n')/ mx:Button x=427 y=53 label=trace click=trace(rightList.dataProvider + quot;\nquot; + rightXML + '\n')/ /mx:Application --end code--
[flexcoders] Re: List dragMoveEnabled problem?
and, if I write code to convert the XML to an ArrayCollection, and bind to the new ArrayCollections, everything works fine. So it seems the problem is when I'm binding to XMLListCollection. Binding to an ArrayCollection is behaving as expected. This is a workaround, but there shouldn't be a problem when using XMLListCollections, I'm guessing? --- code --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=init() mx:Script ![CDATA[ import mx.rpc.http.HTTPService; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] private var leftXML:XML; [Bindable] private var rightXML:XML; private var rightArray:Array = new Array(); private var leftArray:Array = new Array(); [Bindable] private var lac:ArrayCollection; [Bindable] private var rac:ArrayCollection; private function init():void{ getE4X(); } private function getE4X():void{ var feedUrl:String = new String(file:///C:/TestListMoves/xml/lefthand.xml); var loader2:HTTPService = new HTTPService(); loader2.method = POST; loader2.url = feedUrl; loader2.resultFormat = e4x; loader2.requestTimeout = 10; loader2.addEventListener(ResultEvent.RESULT, doLeftLoaded); loader2.send(); } private function doLeftLoaded(event:ResultEvent):void{ leftXML = new XML(event.result); var x:XML; for each (x in leftXML.item){ leftArray.push(x); } lac = new ArrayCollection(leftArray); loadRight(); } private function loadRight():void{ var feedUrl:String = new String(file:///C:/TestListMoves/xml/righthand.xml); var loader2:HTTPService = new HTTPService(); loader2.method = POST; loader2.url = feedUrl; loader2.resultFormat = e4x; loader2.requestTimeout = 10; loader2.addEventListener(ResultEvent.RESULT, doRightLoaded); loader2.send(); } private function doRightLoaded(event:ResultEvent):void{ rightXML = new XML(event.result); var x:XML; for each (x in rightXML.item){ rightArray.push(x); } rac = new ArrayCollection(rightArray); } ]] /mx:Script mx:List x=97 y=135 id=leftList dataProvider={lac} height=409 dragEnabled=true dragMoveEnabled=true dropEnabled=true labelField=@name/mx:List mx:List x=379 y=135 id=rightList dataProvider={rac} height=409 dragEnabled=true dragMoveEnabled=true dropEnabled=true labelField=@name/mx:List mx:Button x=147 y=53 label=trace click=trace(leftList.dataProvider + quot;\nquot; + leftXML + '\n')/ mx:Button x=427 y=53 label=trace click=trace(rightList.dataProvider + quot;\nquot; + rightXML + '\n')/ /mx:Application -- code--
[flexcoders] List dragMoveEnabled problem
This has me baffled.. I have two lists, both with XML data as their dataProviders. If I have dragInitiatorList.dragMoveEnabled=false on the dragInitiatorList, I can copy from the dragInitiatorList to the dropTargetList and dropTargetList.dataProvider and it's bound XML are updated correctly. If I have dragInitiatorList.dragMoveEnabled=true, then when I dragdrop, the dropTargetList.dataProvider reflects the added item but the bound XML does not. Also, the displayed list doesn't show the new item. The item is removed from the dragInitiator.dataProvider but not from it's bound XML. The item, in other words, is not moved as I would expect it to be. If the dropTargetList has an empty dataProvider, or has no dataProvider specified, then everything works fine regardless of the setting of dragInitiatorList.dragMoveEnabled on the dragInitiatorList. (I.e., full - empty works fine. full - full does not) I am only seeing some unexpected results when I'm trying to move from one List with a non-empty dataProvider to another List that also has a non-empty dataProvider *and* dragMoveEnabled=true. I'm about to test this again with a new, clean project, just to make sure I'm not going uttely mad. Has anyone else bumped into anything like this? thanks
[flexcoders] Re: List dragMoveEnabled problem?
The test came up with the same problem - a move from one list to another that has a dataprovider won't perform the move. Do I have to create my own functions to handle the move from one non-empty list to another non-empty list? thanks in advance for help! --- In flexcoders@yahoogroups.com, jasondrubenstein [EMAIL PROTECTED] wrote: This has me baffled.. I have two lists, both with XML data as their dataProviders. If I have dragInitiatorList.dragMoveEnabled=false on the dragInitiatorList, I can copy from the dragInitiatorList to the dropTargetList and dropTargetList.dataProvider and it's bound XML are updated correctly. If I have dragInitiatorList.dragMoveEnabled=true, then when I dragdrop, the dropTargetList.dataProvider reflects the added item but the bound XML does not. Also, the displayed list doesn't show the new item. The item is removed from the dragInitiator.dataProvider but not from it's bound XML. The item, in other words, is not moved as I would expect it to be. If the dropTargetList has an empty dataProvider, or has no dataProvider specified, then everything works fine regardless of the setting of dragInitiatorList.dragMoveEnabled on the dragInitiatorList. (I.e., full - empty works fine. full - full does not) I am only seeing some unexpected results when I'm trying to move from one List with a non-empty dataProvider to another List that also has a non-empty dataProvider *and* dragMoveEnabled=true. I'm about to test this again with a new, clean project, just to make sure I'm not going uttely mad. Has anyone else bumped into anything like this? thanks