国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > Flex > 正文

flex 綁定元數(shù)據(jù)

2024-09-12 17:51:12
字體:
供稿:網(wǎng)友
這是一種將圖片或者flash綁定為數(shù)據(jù)的方法。在代碼中:
[Bindable]
[Embed("assets/closed.png")]
public var myFolderClosedIcon:Class;
這三行代碼是將clsed.png綁定為可用是數(shù)據(jù)。
其中[Embed(...)]是叫做”元數(shù)據(jù)”
注意,需要緊跟著要聲明一個(gè)class變量,這個(gè)class在隨后的代碼中就代表了closed.png這個(gè)元素。
最后看看在mxml中的調(diào)用:
folderClosedIcon=”{myFolderClosedIcon}”
我們看到在Tree組件中,直接調(diào)用了這個(gè)類作為tree中節(jié)點(diǎn)閉合時(shí)前面的ico圖標(biāo)。
要綁定元數(shù)據(jù)還可以使用”元標(biāo)簽”[mx:Metadata]
本文分析的代碼如下:[此段代碼的作用是改變Tree組件的列表圖標(biāo)ICO]
復(fù)制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[

[Bindable]
[Embed("http://longstep.cn/closed.png")]
public var myFolderClosedIcon:Class;
[Bindable]
[Embed("http://longstep.cn/opened.png")]
public var myFolderOpenIcon:Class;

[Bindable]
[Embed("http://longstep.cn/pdf.png")]
public var pdfIcon:Class;
[Bindable]
[Embed("http://longstep.cn/doc.png")]
public var docIcon:Class;

]]>
</mx:Script>
<mx:XML id="xmlData" xmlns="">
<rootNode>
<directory label="dir">
<file icon="pdfIcon" label="label1" />
<file icon="docIcon" label="label2" />
</directory>
<directory label="dir1">
<file icon="pdfIcon" label="label3" />
<file icon="docIcon" label="label4" />
</directory>
</rootNode>
</mx:XML>
<mx:Panel title="Tree">

<mx:Tree
borderStyle="none"
backgroundAlpha="0"
labelField="@label"
iconField="@icon"
width="300"
height="200"
id="treeAdmin"
folderOpenIcon="{myFolderOpenIcon}"
folderClosedIcon="{myFolderClosedIcon}"
dataProvider="{xmlData.directory}" alpha="1" />
</mx:Panel>
</mx:Application>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 会宁县| 阳新县| 色达县| 宜宾市| 阳东县| 芜湖市| 景泰县| 唐海县| 商城县| 江陵县| 德化县| 长汀县| 昆山市| 阜宁县| 临猗县| 奎屯市| 澎湖县| 同心县| 焦作市| 霸州市| 苗栗市| 巨野县| 克什克腾旗| 三台县| 昌吉市| 岐山县| 嘉荫县| 南溪县| 榆林市| 安康市| 中方县| 宣武区| 西丰县| 塘沽区| 桂阳县| 吉木乃县| 临清市| 天水市| 东丽区| 石柱| 雷山县|