Re: [flexcoders] Help with node indentation after drag/drop
On 5/20/05, Rick Schmitty [EMAIL PROTECTED] wrote: Hi Manish thanks for taking the time. I got this code from an earlier post in the FlexCoders list. I wanted to change it to grab from an xml file instead of hard coding it into the mxml The key difference in the two approaches is that one of them uses XML format data whereas the other (the one that doesn't work) uses a tree of objects. If you set resultFormat=xml on the HTTPService, and then point the Tree's dataProvider to treenodes.result instead of treenodes.result.people, it works. I haven't investigated into why the indentation doesn't work with the default resultFormat for HTTPService, and if there are any workarounds. Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Help with node indentation after drag/drop
No need to investigate further, knowing to use the resultFormat is enough for me :) Thanks a bunch Manish!On 5/22/05, Manish Jethani [EMAIL PROTECTED] wrote: On 5/20/05, Rick Schmitty [EMAIL PROTECTED] wrote:Hi Manish thanks for taking the time.I got this code from an earlier post in the FlexCoders list.I wanted to change it to grab from an xml file instead of hard coding it into the mxmlThe key difference in the two approaches is that one of them uses XMLformat data whereas the other (the one that doesn't work) uses a treeof objects.If you set resultFormat=xml on the HTTPService, and then point the Tree's dataProvider to treenodes.result instead oftreenodes.result.people, it works.I haven't investigated into why the indentation doesn't work with thedefault resultFormat for HTTPService, and if there are any workarounds.Yahoo! Groups Links* To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/* To unsubscribe from this group, send an email to: [EMAIL PROTECTED]* Your use of Yahoo! Groups is subject to:http://docs.yahoo.com/info/terms/ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Help with node indentation after drag/drop
On 5/20/05, Rick Schmitty [EMAIL PROTECTED] wrote: Hi all, was wondering if there is some kind of function to 'correct' (?) the indentation after doing a drag/drop with a tree Can you post some code with instructions? Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Help with node indentation after drag/drop
Hi Manish thanks for taking the time. I got this code from an earlier post in the FlexCoders list. I wanted to change it to grab from an xml file instead of hard coding it into the mxml To see it working, comment out line 50 and uncomment line 49 and 75-87 ?xml version=1.0? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ import mx.managers.DragManager; function doDragEnter(event) { event.handled = true; trace(doDragEnter); } function doDragExit(event) { trace(doDragExit); event.target.hideDropFeedback(); } function doDragOver(event) { trace(doDragOver); event.target.showDropFeedback(); if (Key.isDown(Key.CONTROL)) event.action = ""> else if (Key.isDown(Key.SHIFT)) event.action = ""> else event.action = ""> } function doDragDrop(event) { trace(doDragDrop); // Since the drag is over, remove visual feedback from the target. doDragExit(event); var dragItems = event.dragSource.dataForFormat(treeItems); var dest = event.target; //var dropLoc = dest.getDisplayIndex(dest.getTreeNodeAt(0)); var dropLoc = dest.getDropLocation(); var destParentNode = dest.getDropParent(); var dropNode = dest.getNodeDisplayedAt(dropLoc); //var relDropLoc = dest.getDisplayIndex(dropNode); //has to be used when shift dragging (copy) a node; //dest.clearSelected(); for (var i = dragItems.length - 1; i = 0; i--) { destParentNode.addTreeNodeAt(dropLoc, dragItems[i]); //destParentNode.selectItem(dropLoc, true); } } function initApp() { trace(initApp); //firstList.dataProvider = treeDP; treenodes.send(); //secondList.dataProvider = []; } function doDragComplete(event) { trace(doDragComplete); var dragItems = event.dragSource.dataForFormat(source).selectedItems; //trace(event.dragSource.dataForFormat(source).selectedItems); var counter = dragItems.length; for (var i=0;icounter;i++) { var item = dragItems[i]; //trace(item); item.removeTreeNode(); } } function treeResult(event) { firstList.dataProvider=treenodes.result.people; } ]] /mx:Script mx:HTTPService id=treenodes url="" result=treeResult(event)/ !-- this works mx:XML id=treeDP node label=root node label=A node label=1/ node label=2/ /node node label=B node label=3/ node label=4/ /node /node /mx:XML -- mx:Label text=Drag items within the list / mx:HBox marginBottom=6 mx:Tree id=firstList dragEnabled=true height=400 width=300 multipleSelection=true initialize=initApp() dragComplete=doDragComplete(event) dragEnter=doDragEnter(event) dragExit=doDragExit(event); dragOver=doDragOver(event); dragDrop=doDragDrop(event)/ mx:Button label=Reset tree click=treenodes.send()/ /mx:HBox /mx:Application Here is the nodes.xml file in the same directory as this mxml people node label=root node label=A node label=1/ node label=2/ /node node label=B node label=3/ node label=4/ /node /node /people On 5/20/05, Manish Jethani [EMAIL PROTECTED] wrote: On 5/20/05, Rick Schmitty [EMAIL PROTECTED] wrote:Hi all, was wondering if there is some kind of function to 'correct' (?) the indentation after doing a drag/drop with a tree Can you post some code with instructions?Yahoo! Groups Links* To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to:[EMAIL PROTECTED]* Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[flexcoders] Help with node indentation after drag/drop
Hi all, was wondering if there is some kind of function to 'correct' (?) the indentation after doing a drag/drop with a tree For example root -A --1 --2 -B --3 --4 Now if I drag A into B, the B folder will appear correctly root -B --A --3 --4 But when I expand/close A its chilrend don't get updated with the correct indentation roo -B --A --1 --2 --3 --4 Any ideas? Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.