可以做个小实验来看看程序运行到发生三个事件所用的时间:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
initialize="doneNow()"
creationComplete="doneNow()"
applicationComplete="doneNow()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var fruit:ArrayCollection=new ArrayCollection([
{label:"fruit",price:"10"},
{label:"tomato",price:"2o"},
{label:"banana",price:"15"},
{label:"orange",price:"18"}
]);
private function doneNow():void{
tt.text+=getTimer()+"ms"+"\n";
}
]]>
</mx:Script>
<mx:List id="list" x="10" y="10" dataProvider="{fruit}">
</mx:List>
<mx:DataGrid x="226.5" y="10" dataProvider="{fruit}" id="dg">
<mx:columns>
<mx:DataGridColumn dataField="label" />
<mx:DataGridColumn dataField="price"/>
</mx:columns>
</mx:DataGrid>
<mx:Text x="481" y="13" text="" width="142" height="80" id="tt"/>
</mx:Application>
2511ms
2985ms
2988ms
2,
定义了一个字符串str,用this[str]就能得到相应的对象了。
http://cookbooks.adobe.com/post_Specifying_Embedded_Image_Data_in_XML-16317.html