Flex的Tree的Icon问题,求各位帮忙看看啊,谢谢了
我的代码是这样的,但是那个tree 的ItemIcon属性设置后没看到任何效果,图片路径是对的,不知道什么问题,运行后还是系统默认的那套Icon,求各位看看解决一下了,谢谢了!
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.treeClasses.TreeItemRenderer;
import mx.events.FlexEvent;
[Bindable]
[Embed(source="cok.jpg")]
public var imgClass1:Class;
[Bindable]
[Embed(source="ic1.jpg")]
public var imgCls:Class;
[Bindable]
[Embed(source="cs.jpg")]
public var itemIcon:Class;
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:XMLListCollection xmlns="" id="xmlSource">
<s:source>
<fx:XMLList>
<Organization>
<Node label='Root' value='1'>
<Node label='node1' value='2'>
<Node label='node1node1' value='6'>
<Node label='ddd' value='14'></Node>
</Node>
</Node>
<Node label='asasd2' value='3'>
<Node label='aaaaa' value='7'></Node>
</Node>
<Node label='ccas' value='4'>
<Node label='cawea1' value='8'></Node>
</Node>
<Node label='ccas2' value='5'>
<Node label='gasd1' value='9'></Node>
<Node label='sdfas2' value='10'></Node>
</Node>
</Node>
</Organization>
</fx:XMLList>
</s:source>
</s:XMLListCollection>
</fx:Declarations>
<mx:Tree x="59" y="46" width="220" height="456" id="tree1"
dataProvider="{xmlSource}"
labelField="@label" showRoot="false" itemIcons="{imgCls,itemIcon}"></mx:Tree>
</s:Application>