arrayCollection监听事件
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="inti()">
<mx:Script>
<![CDATA[
import mx.events.CollectionEvent;
import mx.collections.ArrayCollection;
private var arr:ArrayCollection;
private function inti():void {
arr = new ArrayCollection();
arr.addItem("1");
arr.addItem("2");
arr.addEventListener(CollectionEvent.COLLECTION_CHANGE,onCh);
}
private function change():void {
trace("cc");
var arra:ArrayCollection = new ArrayCollection();
arra.addItem("1");
arra.addItem("2");
arra.addItem("3");
//arr.addItem("1");
//arr.addItem("2");
//arr = new ArrayCollection(arra);
//arr.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
}
private function onCh(e:CollectionEvent):void {
trace(arr.toString());
}
]]>
</mx:Script>
<mx:Button label="chan" click="change()"/>
</mx:Application>
我想当arr全部更新完之后再执行监听事件..有怎么好的实现思路吧?
[解决办法]
解决结贴吧
[解决办法]
结贴送分吧.