会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
Blog
C0#1J0a1v0a1r0u0b1y0r1a1i1ls0f0l0e0x01
首页
新随笔
联系
管理
订阅
Flex2 Tree从XML文件中加载数据
<?
xml version="1.0" encoding="utf-8"
?>
<
mx:Application
xmlns:mx
="http://www.adobe.com/2006/mxml"
fontFamily
="simsun"
fontSize
="12"
layout
="absolute"
creationComplete
="menu.send();"
width
="242"
height
="442"
>
<
mx:Script
>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var menus:XML;
private function LoadMenu(event:ResultEvent):void{
menus = XML(event.result);
var results:XMLList = menus.node;
tree.dataProvider = results;
}
]]>
</
mx:Script
>
<
mx:HTTPService
url
="TreeMenus.xml"
id
="menu"
useProxy
="false"
showBusyCursor
="true"
result
="LoadMenu(event)"
resultFormat
="xml"
/>
<
mx:Tree
id
="tree"
x
="10"
y
="35"
width
="218"
height
="397"
labelField
="@label"
/>
<
mx:Label
x
="10"
y
="10"
text
="Tree Nodes From XML File"
/>
</
mx:Application
>
xml文件
<?
xml version="1.0" encoding="utf-8"
?>
<
menus
>
<
node
label
="Mail"
>
<
node
label
="Inbox"
/>
<
node
label
="Personal Folder"
>
<
node
label
="Demo"
/>
<
node
label
="Personal"
/>
<
node
label
="Saved Mail"
/>
<
node
label
="bar"
/>
</
node
>
<
node
label
="Calendar"
/>
<
node
label
="Sent"
/>
<
node
label
="Trash"
/>
</
node
>
</
menus
>
posted @
2006-10-22 19:34
Liren
阅读(
1118
) 评论(
1
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告