Flex的Tree的Icon问题,求各位帮忙看看啊,谢谢了

cmc0117 cmc0117 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的代码是这样的,但是那个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>


...全文
评论 5
收藏 已收藏
分享
返回顶部
cmc0117
Flex 4,326 成员 9,103 内容