RE: [flexcoders] custom icons to tree nodes
Yiðit is just creating his XML on the server to include an icon attribute, which the Tree can then automatically pick up. Mrinmoyee, setting an iconFunction doesn't necessarily set the same icon for all of the branch or leaf nodes, it can set individual icons as well. Either way will work, just depends on which is better for your situation. An example using the XML structure you provided would be something like this (warning, this is only pseudocode - but it should be close): //embed the icons you want to use [Embed(source="/images/leaf1.png")] public var leaf1Icon:Class; [Embed(source="/images/leaf2.png")] public var leaf2Icon:Class; //the iconFunction for your Tree public function setNodeIcon(item:Object):Class{ if([EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> == 'LEAF 1'){ return leaf1Icon; } if([EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> == 'LEAF 2'){ return leaf2Icon; } } Hope this helps. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mrinmoyee Sanyal Sent: Thursday, February 22, 2007 2:57 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] custom icons to tree nodes The solution that Yiðit Boyar provided is what I need. My question now is the PHP code that is given above, can I do it in ActionScript? Robert, The functions for the Tree that you have provided below are for specifying the same icons for all branch nodes and again the same icon for all leaf nodes. This is what I want, lets say we have a tree: // this will have icon1.jpg // this will have icon2.jpg // this will have icon3.jpg // this will have icon4.jpg // this will have icon4.jpg -MS On 2/22/07, Robert Chyko < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: http://livedocs.macromedia.com/flex/201/html/dpcontrols_062_22.html <http://livedocs.macromedia.com/flex/201/html/dpcontrols_062_22.html> Hard to say exactly what you need, but an iconFunction might be what you are looking for. Specifying Tree control icons The Tree control provides four techniques for specifying node icons: * The folderOpenIcon, folderClosedIcon, and defaultLeafIcon properties * Data provider node icon fields * The setItemItcon() method * The iconFunction property -Original Message- From: flexcoders@yahoogroups.com [mailto: flexcoders@ <mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] On Behalf Of Mrinmoyee Sanyal Sent: Thursday, February 22, 2007 1:17 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] custom icons to tree nodes How do I insert my custom icons to the individual tree nodes? I am able to insert it on the root node and on the leaf nodes but not on any of the branch nodes. So the problem scenario here is not replacing all the existing folder icons with my icons, but able to insert different icons at different levels of the tree depending on its type. Any help would be appreciated. Thanks -MS
Re: [flexcoders] custom icons to tree nodes
The solution that Yiðit Boyar provided is what I need. My question now is the PHP code that is given above, can I do it in ActionScript? Robert, The functions for the Tree that you have provided below are for specifying the same icons for all branch nodes and again the same icon for all leaf nodes. This is what I want, lets say we have a tree: // this will have icon1.jpg // this will have icon2.jpg // this will have icon3.jpg // this will have icon4.jpg // this will have icon4.jpg -MS On 2/22/07, Robert Chyko <[EMAIL PROTECTED]> wrote: http://livedocs.macromedia.com/flex/201/html/dpcontrols_062_22.html Hard to say exactly what you need, but an iconFunction might be what you are looking for. Specifying Tree control icons The Tree control provides four techniques for specifying node icons: - The folderOpenIcon, folderClosedIcon, and defaultLeafIconproperties - Data provider node icon fields - The setItemItcon() method - The iconFunction property -Original Message- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Mrinmoyee Sanyal *Sent:* Thursday, February 22, 2007 1:17 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] custom icons to tree nodes How do I insert my custom icons to the individual tree nodes? I am able to insert it on the root node and on the leaf nodes but not on any of the branch nodes. So the problem scenario here is not replacing all the existing folder icons with my icons, but able to insert different icons at different levels of the tree depending on its type. Any help would be appreciated. Thanks -MS
RE: [flexcoders] custom icons to tree nodes
http://livedocs.macromedia.com/flex/201/html/dpcontrols_062_22.html Hard to say exactly what you need, but an iconFunction might be what you are looking for. Specifying Tree control icons The Tree control provides four techniques for specifying node icons: * The folderOpenIcon, folderClosedIcon, and defaultLeafIcon properties * Data provider node icon fields * The setItemItcon() method * The iconFunction property -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mrinmoyee Sanyal Sent: Thursday, February 22, 2007 1:17 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] custom icons to tree nodes How do I insert my custom icons to the individual tree nodes? I am able to insert it on the root node and on the leaf nodes but not on any of the branch nodes. So the problem scenario here is not replacing all the existing folder icons with my icons, but able to insert different icons at different levels of the tree depending on its type. Any help would be appreciated. Thanks -MS
Re: [flexcoders] custom icons to tree nodes
i did the same thing to discrete file types; so here is my solution; every files extension is found in the server and embed into the xml result as the "icon" field with the matching variable names in the actionScript. here is the php code : after you send the xml in the above format; you just need to load images to variables so ; in the mx:script tag of the component; i load the icon files to variables: [Bindable] [Embed(source="icons/dosyalar/diger.png")] public var ico_diger:Class; [Bindable] [Embed(source="icons/dosyalar/doc.png")] public var ico_doc:Class; and so on then this will work. if you cannot manage from this info; i can send the php and mxml files directly to your e-mail adress... - Original Message From: Mrinmoyee Sanyal <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Thursday, February 22, 2007 8:16:34 PM Subject: [flexcoders] custom icons to tree nodes How do I insert my custom icons to the individual tree nodes? I am able to insert it on the root node and on the leaf nodes but not on any of the branch nodes. So the problem scenario here is not replacing all the existing folder icons with my icons, but able to insert different icons at different levels of the tree depending on its type. Any help would be appreciated. Thanks -MS Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121
[flexcoders] custom icons to tree nodes
How do I insert my custom icons to the individual tree nodes? I am able to insert it on the root node and on the leaf nodes but not on any of the branch nodes. So the problem scenario here is not replacing all the existing folder icons with my icons, but able to insert different icons at different levels of the tree depending on its type. Any help would be appreciated. Thanks -MS