How do you change the Tree Component Icons?

Hi,
I have been trying to get to grips with the tree component. I
want to
customise it so that I can have a different icon for each
different link.
E.g. a QT logo for a video etc. If no valuse is found for the
'icon'
attribute it will just display the default.
Within my XML file I have created a new attribute for each
link called
'icon' and has a value of 'movie.gif' or something similar.
In my flash file, I have created the following code:
theTree.iconFunction = function (node:XMLNode) {
var iconNode:String = item.attributes.icon;
if (iconNode != undefined) {
return iconNode;
However, it does not seem to work. My knowledge of
ActionScript is pretty
poor so I assume I have made a mistake in there somewhere.
Can anyone help
me with this?
Thanks!

Check out the Component Reference... you change the icon for
a single node, as far as I know there's no automated process beyond
that. So assuming your tree component instance is named "theTree"
you might do this to change the icon of the first node:
theTree.dataProvider = yourXML; // make sure you don't try to
change the icon before you load data into the tree
var theNode = theTree.getTreeNodeAt(0); // the first node in
your tree
theTree.setIcon(theNode,'myIcon'); // set the icon
Where "myIcon" is a MovieClip you have in your library that
you have set the "linkage identifier" as "myIcon".
That iconFunction doesn't make a whole lot of sense to me,
because first of all I don't know why it would be attached to
theTree, and second it's referring to "item" which is not defined,
and third its taking the parameter "node" and not doing anything
with it. But perhaps there is some cool way to make a single
function which handles icons for your entire tree automatically,
that would certainly be nice.
However, like I said, as far as I know that function will do
nothing without calling tree.setIcon() in some way. I just made a
function which might do what you want -- it recursively loops
through an entire tree and sets it's icon based on the XML
attribute "icon":
function setAllIcons(branch){
for(var i in branch.childNodes){
var node = branch.getTreeNodeAt(i);
theTree.setIcon(node,node.attributes['icon']);
if(node.hasChildNodes){
setAllIcons(node);
So basically, you run setAllIcons(theTree.dataProvider) after
you have loaded and applied the XML.

Similar Messages

  • Change the Tree Component background

    Does anyone know how can i change the Tree Component
    background ?
    PLS HELP

    Check out the Component Reference... you change the icon for
    a single node, as far as I know there's no automated process beyond
    that. So assuming your tree component instance is named "theTree"
    you might do this to change the icon of the first node:
    theTree.dataProvider = yourXML; // make sure you don't try to
    change the icon before you load data into the tree
    var theNode = theTree.getTreeNodeAt(0); // the first node in
    your tree
    theTree.setIcon(theNode,'myIcon'); // set the icon
    Where "myIcon" is a MovieClip you have in your library that
    you have set the "linkage identifier" as "myIcon".
    That iconFunction doesn't make a whole lot of sense to me,
    because first of all I don't know why it would be attached to
    theTree, and second it's referring to "item" which is not defined,
    and third its taking the parameter "node" and not doing anything
    with it. But perhaps there is some cool way to make a single
    function which handles icons for your entire tree automatically,
    that would certainly be nice.
    However, like I said, as far as I know that function will do
    nothing without calling tree.setIcon() in some way. I just made a
    function which might do what you want -- it recursively loops
    through an entire tree and sets it's icon based on the XML
    attribute "icon":
    function setAllIcons(branch){
    for(var i in branch.childNodes){
    var node = branch.getTreeNodeAt(i);
    theTree.setIcon(node,node.attributes['icon']);
    if(node.hasChildNodes){
    setAllIcons(node);
    So basically, you run setAllIcons(theTree.dataProvider) after
    you have loaded and applied the XML.

  • How do you change the email account in the Mail icon?

    how do you change the email account in the Mail icon? PLEASE HELP

    Is this your question?
    How to change your e-mail address in Mail application?
    Launch Address Book / Contacts.
    Create a new card with correct information.
    Select / highlight the vCard you want to be referred to.
    Click "Card" from the menu bar and select "Make This My Card".
    Hope this works.

  • How do you change the pink highlight for the present day in calendar when in week view

    How do you change the pink highlight for the present day in calendar when in week view - OSX Maverick

    the current day was light blue in ical in 10.6 but with plenty of contrast, but I recently made the bigger leap all the way to calendar in 10.9. the choice of color is terrible for reasons such as Spile1962 puts below, but also not having any way to tweak it is terrible. I'm on a bran d new imac and can barely see a difference and frankly, while I appreciate the subtlety, I still forget to look for the darker bar across the top of the current week and day. we should be able to adjust weekend and current day bg colors.
    I went into the app's package contents in hopes that they were using a tiff/png file that I could tweak on my own but couldn't find anything for them. all the icons are there, as are the bg sets for all the little pop-ups and things, but I couldn't even find a reference to a hex color in the plist file.
    send apple feedback. I just did myself, except that Calendar hasn't made the list (yet?), only iCal up to version 4.x, and Messages is still only iChat for feedback, and some others are old as well. apparently after steve died, apple's attention to these details just died with him. it's been that long since those other apps should have been relevant on their site.

  • How do you change the channel of the device?

    How do you change the channel of the device?

    Isn't there a way to see what channel it is on so one can choose a different channel?
    Hold down the option key on your Mac while you click on the fan shaped AirPort icon at the top of the screen.
    If you want to manually set the channel on an Apple router, you would use AirtPort Utility for this.

  • How do you change the keyboard so that it types the words for you

    How do you change the keyboard to show the words that you might be typing?  I had it when I first updated but somehow I changed it>

    Sometimes, you might be in a message and accidentally minimize the predictive feature.  If that happens, just swipe UP on the dashed icon right above the keyboard and it will bring it back up.

  • How can you change the banner of the FTP-server on the Linksys WRT610N ?

    Dear readers,
    My question is this : How can you change the banner of the FTP-server on the Linksys WRT610N ?
    At present it says : "Welcome to WRT610 Router's FTP service" which gives away the type of the device.
    Which is a clue I would rather hide. Besides that I would like to change it to something more personal.
    But how do you do that ?
    The UG is silent about this.
    Regards
    John

    Try this to change FTP banner?
    * Login as admin
    * Open Internet Information Services (IIS) Manager
    * Expand FTP sites (from tree view)
    * Right-click on the particular FTP site, select Properties
    * Click on the Messages tab
    * Setup new message
    * Save the changes

  • When you drag a link onto your desktop, how do you change the image for the shortcut?

    When you drag a link onto your desktop, how do you change the image for the shortcut?

    Select it, hit command-i (or choose File -> Get Info), select the icon in the info window and paste something else there.

  • How can you change the display size on the task bar

    how do you change the display size on the task bar

    If, however, you want to change the size of the display of the menubar, meaning make the icons and text larger, there is no way to do that directly other than to change the resolution of the screen.
    You can change the as-viewed size of that temporarily by using either -
    • Mouse zoom - if you have a Magic Mouse (Apple wireless mouse), hold down the Control key and use the scroll up and scroll down finger gestures on the mouse.
    • Zoom - go to System Preferences > Universal Access > Seeing and turn on Zoom. You can also use the noted keyboard shortcut to enable/disable this Zoom feature.

  • HT5312 How do you change the email address used to send security answers?

    How do you change the email used to send the security answers you have forgotten? I have changed the alternative email adress in Name, ID and Email Addresses but this does not change the email address in the Password and Security section.

    Jus what do you want to accomplish? The Apple ID email address is used for variosu thing onthe iPod like:
    - For purchasing media. Srrings.iTunes and App stores. Sing out and sign into anoterh account
    - Settings>iCLoudl for iCloud account
    - Settings>FaceRome for Apple ID and where You can Be Reached At email address
    - Settings>Messages for Send And Receive email address.
    - Maybe for Game Center

  • Same question for the "2 iPhones in one account".....How do I change the name.  My iPhone is showing my wife's iPhone name when I am syncing it.  Why is that?  I know about using one iTunes account....But how do you change the name w/o erasing your data?

    Hi....How do you change the name?  When I sync my iPhone, it shows my wife's name on it?

    Unfortunately it is not doing it....
    Let me give more details..We have 3 iPods and 2 iPhone4....I recently purchased the iPhone4 and when we connected it..It was already reading my wife's iPhone4..We went to the Apple Store at the Grove today and was told to de-authorize the system and connect my iPhone4 back and I should be able to change the name.
    Nothing happened..Right now, I clicked on RESTORE settings...and it is uploading a new iPhone update. 

  • HT204053 I used one Apple ID to set up iCloud after iOS 6 was downloaded to my iPhone, now I want to change the Apple ID for iCloud on my iPhone but I'm unable to. How do you change the ID after it's been set up?

    I used one Apple ID to set up iCloud after iOS 6 was downloaded to my iPhone, now I want to change the Apple ID for iCloud on my iPhone but I'm unable to. How do you change the ID after it's been set up?

    See https://discussions.apple.com/message/19218571#19218571.

  • How do you change the Apple ID for my iPhone 4?

    How do you change the Apple ID for my iPhone 4. I am able to access my iTunes account using my new ID and password on my computer; however, my iphone has a different Apple ID and I do not have cannot access iTunes on this phone. 

    Also, if you have iCloud, you will probably also want to change the iCloud account on the phone to be yours:
    Settings>iCloud - if Account is not yours, go to the bottom and Delete Account. Then sign back on with your iCloud account info.
    Cheers,
    GB

  • How do you change the color of events on ICal.

    How do you changed the color of events on ICal? I was able to do this when I utilized ICal on the Snow Leopard system but can no longer do this with Lion.
    I know that I can select the Calanders list, but when I create a new "Calander" it doesn't allow me to choose a color and it doesn't show up in my list when working within an event.
    Thanks!

    Phoebe,
    Right-click on the new calendar and select "Get Info."
    Make sure that the ✓ mark is selected.
    Then choose the color from this pane:

  • How do you change the I'd on the log in screen when you want to update your apps and the I'd  is wrong

    How do you change the I'd on the log in screen when you want to update your apps and the I'd  is wrong and the password is also wrong. HELP

    Go to Settings>Store>Apple ID. Tap on the ID and sign out. Then tap on "sign in" and sign in with the correct account.

Maybe you are looking for

  • Can no longer see my inbox or my other e-mail accounts

    I have 3 e-mail accounts on my iphone 4....I've got my work e-mail, my gmail and my icloud mail.  I used to be able to click on the Mail app and it would go straight into the list of mailboxes that I have.  I could click on a mailbox and it would go

  • Error while creating Excise invoice in J1iA

    Hi While trying to create an excise invoice using J1iA, the system gves an error message "material type 000000000500852 does not match with master". Note that the number 500852 is one of the materials in the PO. Why this error and how to reolve it? P

  • Delete Fact and Dimension Tables

    Hai All,           Small question! When deleting data from info cube, it asks whether to delete just Dimension table or both fact and Dimension tables. What is the difference between these two? Thank you.

  • Can I repair the ntdll.dll fault that prevents InDesign CS4 from opening in Windows 7?

    I am running Windows 7, all updates installed, and CS4, updated to 6.0.6.622. This problem does not affect any other app in CS4. Starting yesterday, InDesign would crash as soon as I opened a document. Then it would crash before I could open a docume

  • How can I get my Iphone to trainsfer info to my Outlook on my computer?

    How can I get my Iphone to trainsfer info that I created on the phone to my Outlook ( contacts, calender) on my computer? I know there is a tab in Itunes but you can not highlight it. I know this question was asked before in Feb.08 but I could not fi