I'm sorry to keep asking what should be simple questions, but I have killed hours on this. Even the debugger is no help.
I have a situation where I need to change the icon of a Tree branch or node depending upon what it is. I created a Tree and populated it with XML data and that all works great. I tried to figure out how to specify the icon in the XML but no joy.
So I wrote an iconFunction and assigmed it to the proper Property in the Tree.
Here is some of the XML:
Code:
<mx:XML id="sitree">
<PATPID label="PAT PID 0x0000">
<PMTPID label="PMTPID 0x0010 - Network">
<SDT label="VNUS0"></SDT>
</PMTPID>
<PMTPID label="PMTPID 0x0020 - Program 750">
<ESPID label="ES PID 0x1022">
<CA label="CA Descriptor"></CA>
</ESPID>
</PMTPID>
<PMTPID label="PMTPID 0x0020 - Program 751">
<SDT label="VNUS0"></SDT>
</PMTPID>
</PATPID>
</mx:XML>
I put a breakpoint in my iconFunction and so I know its being called. I just don't know how to make it work. Here it is:
Code:
<mx:Script>
<![CDATA[
[Embed("c:/zanalyzer/client/icons/si_base.png")] var icoSiBase:Class;
[Embed("c:/zanalyzer/client/icons/log_warn.png")] var icoLogWarn:Class;
public function siTreeIcon(item:Object):Class {
if( /* SOME TEST I CANT FIGURE OUT */ )
{
return icoSiBase;
}
return icoLogWarn;
}
]]>
</mx:Script>
So what is it I am supposed to be testing for? It seems that the object passed in to my function would be of type PATPID (in the case of the root node) and the debugger shows that item contains the xml I wrote, but I can't figure out how to test for that.
Thanks very much...
Jim