Hi people, please help if anyone knows the solution for this. I want to play 4 external swf video files so that the first video (intro) plays only once and the rest 3 play in a loop after the first one. So this is the code i’m using in the swf loader file:
// Array of external clips to use. Variable index refers to next clip to be displayed.
var clips:Array=["film_index.swf","film_gledamsat.swf","film_glancam.swf","film_palacgore.swf"];
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);
}
// 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);
trace("value of index was: " + index);
index++;
trace("value of index is now: " + index);
if (index > clips.length)
{
index = 1;
trace("value of index reset to: " + index);
}
nextClip();
}
}
// Call nextClip to automatically start the first clip
nextClip();
and it doesn’t work. Does anyone know what i’m doing wrong??? Thank You very much!