Timer AS3错误#1009
请帮助我,检查此代码: 这是输出: TypeError:错误#1009:无法访问空对象引用的属性或方法。 在佛罗里达州的Bechanodroid_LatihanPendahuluan_:main timeline/tick1()[佛罗里达州的Bechanodroid_LatihanPendahuluan_.main timeline::frame3:21] at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() 这是我的代码:Timer AS3错误#1009,timer,Timer,请帮助我,检查此代码: 这是输出: TypeError:错误#1009:无法访问空对象引用的属性或方法。 在佛罗里达州的Bechanodroid_LatihanPendahuluan_:main timeline/tick1()[佛罗里达州的Bechanodroid_LatihanPendahuluan_.main timeline::frame3:21] at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() 这是
import flash.utils.Timer;
import flash.events.TimerEvent;
var countDownInc:Number = 1;
var totalSecs = 10;
var countDownSecs = totalSecs;
timer.text = countDownSecs;
var time:Timer = new Timer(countDownInc*1000);
time.start();
time.addEventListener(TimerEvent.TIMER,tick);
function tick(e:TimerEvent):void{
if(countDownSecs==0){
time.stop();
score+=0;
nextPertanyaan();
countDownSecs=totalSecs;
}else{
countDownSecs=countDownSecs-countDownInc;
timer.text=countDownSecs;
}
this.removeEventListener(Event.ENTER_FRAME, tick);
}
这一行:
this.removeEventListener(Event.ENTER_FRAME,勾选)
将其更改为:
e、 currentTarget.removeEventListener(TimerEvent.TIMER,勾选)