Hi Douglas,

 

It is carrying the leaf nodes properly; I think the issue revolved around
how you were trying to display the items.

 

public function handleMe(event:DragEvent) : void    {

            var ds:Array = event.dragSource.dataForFormat("treeItems") as
Array; 

            for( var i:int = 0; i < ds.length; i++ ){

                        trace(XML(ds[i]).toXMLString());

            }

}

 

Hope this helps,

Michael

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Douglas Knudsen
Sent: Wednesday, March 14, 2007 12:11 AM
To: [email protected]
Subject: [flexcoders] Re: Tree, drag+drop, and XML

 

here is example code of what I am seeing.  Why doesn't a leaf carry the data
in the drag event?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" <http://www.adobe.com/2006/mxml>
http://www.adobe.com/2006/mxml"; layout="vertical">

    <mx:Script>
        <![CDATA[
            import mx.events.DragEvent;
            import mx.controls.Alert;
            import mx.core.DragSource;
            import mx.utils.ObjectUtil;
            
            public function handleMe( event:DragEvent) : void    {
                var ds:Array = event.dragSource.dataForFormat("treeItems")
as Array; 
                Alert.show(ObjectUtil.toString(ds));
            }
        ]]>
    </mx:Script>

        <mx:XML id="treeData">
        <node label="Mail Box"> 
            <node label="Inbox">
                <node label="Marketing"/>
                <node label="Product Management"/>
                <node label="Personal"/> 
            </node>
            <node label="Outbox">
                <node label="Professional"/>
                <node label="Personal"/>
            </node> 
            <node label="Spam"/>
            <node label="Sent"/>
        </node>    
    </mx:XML>
    
    <mx:Tree id="myTree" 
        labelField="@label" 
        showRoot="false"
        itemRenderer="renderer.ActivityTaskTree"
        dataProvider="{treeData}"
        dragEnabled="true" />
        
        
     
     <mx:TextArea text="drop enter here" dragEnter="handleMe( event )">
         
     </mx:TextArea>
    
</mx:Application>



On 3/13/07, Douglas Knudsen <douglasknudsen@
<mailto:[EMAIL PROTECTED]> gmail.com> wrote:

I have a Tree, and a dream it seems.  The Tree's dataProvider is XML based.
The Tree looks lovely and bares leaves.  I set dragEnabled = true.  On
another object in my app I am capturing the dragEnter event with this mehtod


private    function doDragEnter(event : DragEvent) : void {
            
             var ds:Array = event.dragSource.dataForFormat("treeItems") as
Array;
             
             Alert.show (ObjectUtil.toString(ds));return;
           
         }

Now, if I drag a leaf over this object, the Alert above displays
(Array)#0
[0]

as in it does NOT display the XML frag represented by the leaf. 

If I drag a branch, item with the folder icon, the Alert above displays
(Array)#0
[0]<node label=.......</node>

it displays the XML frag for the branch and all its children?

WT?  

-- 
Douglas Knudsen
http://www.cubiclem <http://www.cubicleman.com> an.com
this is my signature, like it? 




-- 
Douglas Knudsen
http://www.cubiclem <http://www.cubicleman.com> an.com
this is my signature, like it? 

 

Reply via email to