var clips:Array = ["introswf","pt1.swf","pt2.sfw" ];
var index:int = 0;
// Stuff for loading files
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
var thisMC:MovieClip = new MovieClip();
stage.addChild(thisMC); // Add empty MC initially so the nextClip function works even on first call
// Gets the next MC, waiting for INITialization before adding it to the stage
function nextClip():void {
thisLoader.load( new URLRequest(clips[index]) );
}
// Remove old clip, tell AS that the loaded file is the new one, add it to the stage, and play.
function doneLoading(e:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
thisMC.addEventListener(Event.ENTER_FRAME, runOnce);
stage.addChild(thisMC);
thisMC.gotoAndPlay(1);
//I added this to center the movieclips --Evan----------------------------

//thisMC.x=150;
//thisMC.y=100;
}
// When currentFrame equals totalFrames in loaded clip (playing), increment index & play the next clip.
function runOnce(e:Event):void {
if (thisMC.currentFrame == thisMC.totalFrames) {
thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);
index = (index + 1)%(clips.length);
nextClip();
}
}
// Call nextClip to automatically start the first clip
nextClip();
// Call nextClip to automatically start the first clip
nextClip();
Bookmarks