Hey guys,
Here’s my problem. I have this code:
function playbackClick(e:MouseEvent):void
{
for (i=0;i<clickArray.length;i++){
var myTimer:Timer = new Timer(clickArray**1000, 1);
myTimer.start();
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler);
}
}
function completeHandler(e:TimerEvent):void
{ switch (tipArray*)
{
case "o1":
case "b1":
trace("CASE 1 and 2");
break;
case "g1":
case "r1":
trace("CASE 3 and 4");
}
}
In my playbackClick function I have a for loop that uses a variable called ‘i’.
I also call a timer event. I would now like to use the ‘i’ variable in the completeHandler function, but the problem is ‘i’ is always the last number and not every number in the array.
For example if the array is 3 items long, ‘i’ in the completeHandler is always 2 and not 0 then 1 and then 2.
What should I do? I hope that you understand my question, if not, say so and I will try to make it more clear.