There’s 3 boxes I’m indexing through with a timer. They disappear in sequence. How do I make them reappear?
Thanks
boxes disappear in sequence 1-3
var pink:Array = ["","boxInstance1","boxInstance2","boxInstance3"];
var timer:Timer = new Timer(555);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
var counting:*;
counting = String(timer.currentCount %10);
trace(counting);
//TIMER LOOPS THROUGH MY ARRAY
this[pink[counting]].visible = false;
}
I tried this ‘it didn’t work’
//THIS IS OK
if(counting> 0){
this[pink[counting]].visible = false;
}
//'null object ref #1010'
if(counting> 6){
this[pink[counting]].visible = true;
}
I’m not to particular about the sequence they disappear and appear, but it need to keep going in a loop.
You’re setting counting to be between 0 and 5 (timer.currentCount %6)
then you’re only doing your visible = true if counting > 6.
Counting is never going to be > 6 🙂
Try checking that it’s >= 3 🙂
Something like this should work (NB Not tested, written from memory)