Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30480102
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: 系统运维

2008-06-27 09:54:05

xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=""
     fontFamily
="simsun" fontSize="12"
     layout
="absolute" creationComplete="menu.send();" width="242" height="442">
<mx:Script>
    

         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>
阅读(2222) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~