Use the TreeDataProvider methods to get
the label, myObj[0].getProperty(‘label’)
Matt
This seems to work fine when the dataProvider for the tree is a
static
mx:XML node list, but when the node list is the
result of a
remoteObject, the
dataForFormat("treeItems") returns an undefined. I
think what I am trying to do is very simple.
I have a tree which is populated by a remoteObject
call, this works
fine.
The XML returned from the remoteObject Call is in
this format:
<node label="Test>
<node label="Test.txt/>
<node label="Test2.txt"/>
</node>
Tree now works fine.
Now, in the doDragDrop(event) function I call
another method (after
clearing the List and populating it with this
dragsource object)
called: sendFile(event)
Which does this:
var myObj:Object =
event.dragSource.dataForFormat("treeItems");
var fileName:String = String(myObj[0]);
mx.core.Application.alert(fileName);
All i get is undefined. If I try a .label or .node
I also get an
undefined.
How can I get the label?
Regards,
Iain
--- In [email protected],
"Matt Chotin" <[EMAIL PROTECTED]>
wrote:
> Yep, dataForFormat("treeItems") I
think is what you want. As for
only
> having one item in the destination List, you
could simply clear
the list
> before adding in the treeItems in the
dragDrop handler.
>
>
>
> Matt
>
>
>
> ________________________________
>
> From: [email protected]
[mailto:[email protected]]
On
> Behalf Of digital_eyezed
> Sent: Wednesday, May 25, 2005 8:45 AM
> To: [email protected]
> Subject: [flexcoders] Drag and Drop from tree
to List
>
>
>
> Hi,
>
> I'm dragging and dropping from a tree to a
list.
>
> All the functionality works fine, but I'm
trying to call another
> method when the item is dropped with the name
of the file from the
> tree as the argument to that method.
>
> Example: Tree has two objects in a folder
node called files:
>
> File1.txt and File2.txt
>
> When I drag from the tree and drop into the
List container (List1)
I
> want to call a method which has the File1.txt
or File2.txt as the
> argument. Can I use the dataForFormat?
>
> Also if I want to restrict this list to only
having 1 file in it
how
> can I have it to only have the last item that
I dropped into it,
> thus removing the previous item, if there was
one there.
>
> I tried to put a change event handler on the
list, but when you
drop
> an Item into the list this event is not
called, which I find
> extremely wierd being that the list has in
fact 'changed'. Explain
> that one!
>
> Regards,
>
> Iain
>
>
>
>
>
>
> ________________________________
>
> 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]
>
<mailto:[EMAIL PROTECTED]
subject=Unsubscribe>
>
> * Your use of
Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>
.
Yahoo! Groups Links