<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#D99191">
<mx:Array id="coffeeArray">
</mx:Array>
<mx:Script>
<![CDATA[
internal function InitLs():void
{
var srcArr:Array = new Array();
srcArr.push("China Soft");
srcArr.unshift("BOCO");
srcArr.unshift("PCCW");
SrcLs.dataProvider = srcArr;
var desArr:Array = new Array("PM", "PL", "SE");
DesLs.dataProvider=desArr;
}
]]>
</mx:Script>
<mx:List x="111" y="92" height="282" id="SrcLs" width="200"></mx:List>
<mx:List x="568" y="92" height="282" id="DesLs" width="200"></mx:List>
<mx:Button x="334" y="123" label="初始化" width="167" click="InitLs()"/>
<mx:Button x="334" y="193" label="Button" width="167"/>
<mx:Button x="334" y="282" label="Button" width="167"/>
</mx:Application>
用于在点击按钮的时候,让列表加载数据,非常简单,效果如下图所示
标签:flex,srcArr,unshift,列表,var,new,Array,dataProvider,数据 From: https://blog.51cto.com/u_15990596/6101106