Loading external swfs in a linear&non-linear way

Hi,
I’m working on a project and the deadline is near :worried: but I’m stuck at making my video presentation work. So here’s the problem: it should be played linearly and non-linearly. Because the video files are long, i keep them in 9 seperate swfs. If you don’t press any buttons, the presentation runs smoothly, but the problems start when you try to jump forward/backward to another part.
Here’s my code so far (I don’t have much experience with as3, so it’s mostly based on tutorials):


var clips:Array = ["swf/btn1.swf", "swf/btn2.swf", "swf/btn3.swf", "swf/btn4.swf", "swf/btn5.swf", "swf/btn6.swf", "swf/btn7.swf", "swf/btn8.swf", "swf/btn9.swf"];
var index:int = 1;




var swf:MovieClip;
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);

var thisMC:MovieClip = new MovieClip();
stage.addChild(thisMC); 

function nextClip():void {
thisLoader.load( new URLRequest(clips[index]) );
}




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);
}




function runOnce(e:Event):void {
if (thisMC.currentFrame == thisMC.totalFrames) { 
thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);
index = (index)%(clips.length);

nextClip();
}
}



nextClip();



var moj_swf:URLRequest = new URLRequest("swf/btn1.swf");

thisLoader.load(moj_swf);
addChild(thisLoader);


function btnClick1(event:MouseEvent):void {
	
	removeChild(thisLoader);
	SoundMixer.stopAll();
	var nowy_swf:URLRequest = new URLRequest(clips[0]);
	thisLoader.load(nowy_swf);
	addChild(thisLoader);
}
function btnClick2(event:MouseEvent):void {

	removeChild(thisLoader);
	SoundMixer.stopAll();
	var thisMC:URLRequest = new URLRequest(clips[1]);
	thisLoader.load(thisMC);
	addChild(thisLoader);

	
}
function btnClick3(event:MouseEvent):void {
	
	removeChild(thisLoader);
	SoundMixer.stopAll();
	var nowy_swf:URLRequest = new URLRequest("swf/btn4.swf");
	thisLoader.load(nowy_swf);
	addChild(thisLoader);
}
function btnClick4(event:MouseEvent):void {
	
	removeChild(thisLoader);
	SoundMixer.stopAll();
	var nowy_swf:URLRequest = new URLRequest("swf/btn7.swf");
	thisLoader.load(nowy_swf);
	addChild(thisLoader);
}
function btnClick5(event:MouseEvent):void {
	
	removeChild(thisLoader);
	SoundMixer.stopAll();
	var nowy_swf:URLRequest = new URLRequest("swf/btn9.swf");
	thisLoader.load(nowy_swf);
	addChild(thisLoader);
}

btn1.addEventListener(MouseEvent.CLICK, btnClick1);
btn2.addEventListener(MouseEvent.CLICK, btnClick2);
btn4.addEventListener(MouseEvent.CLICK, btnClick3);
btn7.addEventListener(MouseEvent.CLICK, btnClick4);
btn9.addEventListener(MouseEvent.CLICK, btnClick5);







When I click on a button, it plays the same swf over and over… but i want to keep it in order (such as in the array). It used to work, but I had problems with sound and must’ve messed something up. Can’t figure it out.

Thank you for your help :love_heart: