<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
// Initialize the data provider for the Tree.
private function initApp():void {
firstList.dataProvider = treeDP;
}
[Embed(source="iconForLevel1.png")]
private var iconForLevel1:Class;
private function geticon(item:Object):Class{
var i:int = 0;
while (item.parent()!=null) {
item = item.parent();
i++;
}
switch (i){
case 1:
return iconForLevel1;
break;
}
return null;
}
]]>
</mx:Script>
<mx:XML id="treeDP">
<node label="Mail">
<node label="Inbox"/>
<node label="Personal Folder">
<node label="Demo"/>
<node label="Personal"/>
<node label="Saved Mail"/>
<node label="bar"/>
</node>
<node label="Calendar"/>
<node label="Sent"/>
<node label="Trash"/>
</node>
</mx:XML>
<mx:Tree id="firstList" iconFunction="geticon" height="200" width="200"
showRoot="false"
labelField="@label"
dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"
allowMultipleSelection="true"
creationComplete="initApp();"/>
</mx:Application>
Jason
-----Message d'origine-----
De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] la part de Flapflap
Envoyé : mardi 16 mai 2006 17:30
À : Flexcoders
Objet : [flexcoders] Data of tree item
hi there,
Again with a tree ;-)
Is there a way to easily retrieve the data from dataProvider of an item
of a tree.
In my mind a simple getItemAt(index) should work but this method dosen't
exists (we can only have child with getChildAt, but child are displayObect)
Thanks
--
Flapflap[at]sans-facon.net --
DevBlog : http://www.kilooctet.net
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
Visit your group "flexcoders" on the web.
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 Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.