加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex:Tree中自定义ICON的几种方式

发布时间:2020-12-15 05:02:11 所属栏目:百科 来源:网络整理
导读:1、默认的Tree的属性是文件夹和文件都是通过 folderOpenIcon , folderClosedIcon ,and defaultLeafIcon 来执行的,如果在程序中需要取得默认的参数可以通过这几个参数进行处理 ????var myMenu:SysMenu = SysMenu(item); ????if(myMenu.children.length==0){
?
http://yecon.blog.hexun.com/30744073_d.html
?
?

<?xml?version="1.0"?encoding="utf-8"?>
<!--?http://yecon.blog.hexun.com/30744073_d.html?-->
<mx:Application?xmlns:mx="http://www.adobe.com/2006/mxml"
????????layout
="vertical"
????????verticalAlign
="middle"
????????backgroundColor
="white">

????
<mx:Script>
????????
<![CDATA[
????????????[Bindable]
????????????[Embed("assets/bullet_go.png")]
????????????private?var?myBulletGoIcon:Class;

????????????[Bindable]
????????????[Embed("assets/bullet_star.png")]
????????????private?var?myBulletStarIcon:Class;

????????????[Bindable]
????????????[Embed("assets/bullet_wrench.png")]
????????????private?var?myBulletWrenchIcon:Class;

????????????private?function?tree_iconFunc(item:Object):Class?{
????????????????var?iconClass:Class;
????????????????switch?(XML(item).localName())?{
????????????????????case?"league":
????????????????????????iconClass?=?myBulletGoIcon;
????????????????????????break;
????????????????????case?"division":
????????????????????????iconClass?=?myBulletStarIcon;
????????????????????????break;
????????????????????case?"team":
????????????????????????iconClass?=?myBulletWrenchIcon;
????????????????????????break;
????????????????}
????????????????return?iconClass;
????????????}
????????
]]>
????
</mx:Script>

????
<mx:XML?id="dp">
????????
<mlb>
????????????
<league?label="American?League">
????????????????
<division?label="East">
????????????????????
<team?label="Boston"?/>
????????????????????
<team?label="New?York"?/>
????????????????????
<team?label="Toronto"?/>
????????????????????
<team?label="Baltimore"?/>
????????????????????
<team?label="Tampa?Bay"?/>
????????????????
</division>
????????????????
<division?label="Central">
????????????????????
<team?label="Cleveland"?/>
????????????????????
<team?label="Detroit"?/>
????????????????????
<team?label="Minnesota"?/>
????????????????????
<team?label="Chicago"?/>
????????????????????
<team?label="Kansas?City"?/>
????????????????
</division>
????????????????
<division?label="West">
????????????????????
<team?label="Los?Angeles"?/>
????????????????????
<team?label="Seattle"?/>
????????????????????
<team?label="Oakland"?/>
????????????????????
<team?label="Texas"?/>
????????????????
</division>
????????????
</league>
????????
</mlb>
????
</mx:XML>

????
<mx:Tree?id="TreeProject"
????????????dataProvider
="{dp.league}"
????????????labelField
="@label"
????????????showRoot
="true"
????????????iconFunction
="tree_iconFunc"
????????????width
="320"
????????????height
="240"?/>

</mx:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读