Hello,
I have the following code, which works normally on its own:
tRef.vid1Listener.ready = function():Void {
tRef.vid1_mc.vid.seekSeconds(tRef.cp1Time);
};
tRef.vid1_mc.vid.addEventListener("ready", tRef.vid1Listener);
however, i have four of these listeners, so i just wanted to run a loop on it so that it works without having to write each separately. here is my loop, that doesnt work:
for (var i:Number = 1; i <= vidNum; i++) {
var ob:Object = new Object();
ob.id = i;
// put movies at proper start times
tRef["vid" + ob.id + "Listener"].ready = function():Void {
if (ob.id < 4) {
tRef["vid" + ob.id + "_mc"].vid.seekSeconds(tRef["cp" + ob.id + "Time"]);
}
};
tRef["vid" + ob.id + "_mc"].vid.addEventListener("ready", tRef["vid" + ob.id + "Listener"]);
}
i’ve done this like a million times but im having the hardest time figuring out why its not working. actually, i did pinpoint the problem, in that ob.id reads out as 4 on every iteration, but why is it not reading as 1, 2, 3, 4 like it should? i’m just having a terrible computer day so if anyone can help me with my brainfart, i’d greatly appreciate it. thanks.