有关XML对象
代码:
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"><s:Button x="64.5" y="237" label="加载XML数据" id="loader" click="OnClick()"/><s:Button x="446.5" y="237" label="清空XML数据" id="loader0" click="OnClear()"/><s:TextArea x="10" y="10" height="219" width="576" id="txt"/><fx:Script><![CDATA[internal function OnClick():void{var ids:Array = [001,002,003];var names:Array = [["戴佩妮:原谅我就是这样的女生(CD)","¥37"],["范玮琪:2009最新专辑F ONE(CD)","¥33"],["李宇春:2009WHY ME 广州演唱会(DVD)","¥28"]];var list:XML = new XML("<cdlist></cdlist>");for(var i:int =0; i<3; ++i){var newnode:XML = new XML();newnode =<cd id={ids[i]}><title>{names[i][0]}</title><price>{names[i][1]}</price></cd>list = list.appendChild(newnode);}txt.text = list.toString();}internal function OnClear():void{txt.text="";}]]></fx:Script><fx:Declarations><!-- 将非可视元素(例如服务、值对象)放在此处 --></fx:Declarations></s:Application>
效果: