<? xml version="1.0" encoding="utf-8" ?> <!-- 版本号(必选)和编码格式(可选) --> < mx:Application xmlns:mx ="http://www.adobe.com/2006/mxml" layout ="absolute" > <!-- layout="absolute" 布局方式:绝对定位 --> <!-- 定义一数组,数组包含四个元素 --> < mx:Array id ="array1" > < mx:String > 111 </ mx:String > < mx:String > 222 </ mx:String > < mx:String > 333 </ mx:String > < mx:String > 444 </ mx:String > </ mx:Array > < mx:List dataProvider ="{array1}" width ="50" x ="2" y ="10" ></ mx:List > <!-- dataProvider属性表示List组件的数据源 --> <!-- <mx:Array id="array2"></mx:Array> <mx:Script> <![CDATA[ public var array2:Array=new Array(); array2.push("555"); array2.push("666"); array2.push("777"); array2.push("888"); ]]> </mx:Script> <mx:List dataProvider="{array2}" width="50"></mx:List> --> < mx:XML xmlns ="" id ="myData" > < node label ="资料" > < node label ="music" > < node label ="古典" /> < node label ="摇滚" /> < node label ="民歌" /> </ node > < node label ="Movie" > < node label ="法国" /> < node label ="美国" /> </ node > </ node > </ mx:XML > < mx:Tree labelField ="@label" dataProvider ="{myData}" x ="60" y ="10" width ="180" ></ mx:Tree > </ mx:Application >