数组运行正常,但得到警告,as3

时间:2010-06-22 19:06:34

标签: flash actionscript

提示出现全部解除或继续,但是瑞士法郎完美无缺。我该如何纠正?
感谢。

错误

TypeError: Error #1010: A term is undefined and has no properties.
    at testONE_fla::MainTimeline/onTimer()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

LightUpSign'数组是指舞台'

上的实例名称
import flash.utils.Timer;
import flash.events.TimerEvent;
var prog:Array = ["","prog1","prog2","prog3","prog4","prog5","prog6","prog7"];
var timer:Timer = new Timer(144);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();

function onTimer(evt:TimerEvent):void {
var counting:uint = timer.currentCount % 8;
this[prog[counting]].visible = this[prog[counting]].visible ? false : true;
}

网络
当我用HTML执行swf时,没有警告,它工作正常。

1 个答案:

答案 0 :(得分:1)

我的猜测是,你在舞台上的对象列表中有一个空字符串。如果用于暂停闪烁,请尝试删除该空字符串并将其用作onTimer事件:

var prog:Array = ["prog1","prog2","prog3","prog4","prog5","prog6","prog7"];

function onTimer(evt:TimerEvent):void {
var counting:uint = timer.currentCount % 8;
if(counting == 0) return;
counting--;
this[prog[counting]].visible = !this[prog[counting]].visible;//no need for ternary operator
}

可能有一种更清洁的方法,但你明白了。如果有效,请告诉我。