I know this question has been answered in several forms on this forum, but I haven't been able to find an answer that works in my case.
I have 6 movies that I want to load in to a swf and I want movie #2 to start playing when movie #1 is done, and so forth. I have tried this code, but it just replays the first movie again and again.
Code:
var tut01:tutorial01 = new tutorial01();
var target:DisplayObject;
var startTime:Number;
var duration:Number;
addChild(tut01);
tut01.play();
function clipDuration (duration:Number):void {
tut01.duration = duration;
target.addEventListener(Event.ENTER_FRAME, enterFrameListener);
}
function enterFrameListener (e:Event):void {
var elapsed:Number = getTimer()-startTime;
var percentDone:Number = elapsed/duration;
if (percentDone == 1) {
gotoAndPlay("tutorial02");
target.removeEventListener(Event.ENTER_FRAME, enterFrameListener);
}
}
I have created six frames in the swf that is loading these movies (one for each movie), that's what the 'tutorial02' is referring to.
Thanks for any help!