我想function<display()>
每 3 秒运行一次。当我运行该函数时,出现以下错误:
RangeError: Error #1125: The index 7 is out of range 4.
at views::twoHomeView/onTimer()[C:\Users\Kinect\Adobe Flash Builder 4.6\yattah\src\views\twoHomeView.mxml:26]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
我的代码是:
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.utils.Timer;
private var timer:Timer;
public function Main():void {
timer = new Timer(1000, 3);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
var kaisu:int =0;
private function onTimer(event:TimerEvent):void {
for(var i:int;i<5;i++){
display(n[kaisu]);
kaisu += kaisu+1;
}
}
]]>
</fx:Script>