PDA

View Full Version : three component with icons from xml


vlad2005
06-03-2007, 08:52 AM
i have an three component. I want to put some custom icons to each item, using xml. Code until now is:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private function initApp():void {
myT.dataProvider = myXML;
}
private var myXML:XML =
<rows>
<node label="Paris">
<node label="location1">
<node label="all" />
</node>
<node label="location2">
<node label="all" />
</node>
<node label="location3">
<node label="all" />
</node>
</node>
</rows>
]]>
</mx:Script>
<mx:Tree id="myT" x="274" y="149" labelField="@label" width="287" creationComplete="initApp();"
showRoot="false">
</mx:Tree>

</mx:Application>

How can do this task?

dr_zeus
06-04-2007, 06:20 PM
Like the labelField property to set the label, there's an iconField property to set the icon. The iconFunction property might be useful for you too, if your icons aren't images that you load from a URL.

vlad2005
06-05-2007, 05:36 PM
i know that, but i can't make to work. I dont have many experience with actionscript 3. Is best to use second option, with image load from url. If u can give me some example, please!!