ActionScripts 3计时器事件问题

时间:2017-02-09 10:44:15

标签: actionscript-3 animate-cc

我正在尝试为Timer使用一些代码并在完成计时器事件后执行某些操作,但代码无法正常工作。

import flash.net.*;
import flash.events.Event;
import flash.display.DisplayObject;
import flash.utils.Timer;
import flash.events.TimerEvent;

var STATE_TIMER:Timer = new Timer(6000,100); 
STATE_TIMER.addEventListener(TimerEvent.TIMER, timerListener); 
function timerListener (e:TimerEvent):void 
{ 
  trace("SMS_SENDER(); Timer Executed."); 
  SMS_SENDER();
} 

STATE_TIMER.addEventListener(TimeEvent.TIMER_COMPLETE, timerDone);
function timerDone(e:TimerEvent):void{
trace("Timer finished!");
}

输出:

Scene 1, Layer 'STORE2', Frame 77, Line 15, Column 30   1120: Access of undefined property TimeEvent.

1 个答案:

答案 0 :(得分:1)

它只是一个错字

TimeEvent.TIMER_COMPLETE应该是TimerEvent.TIMER_COMPLETE