Hey guys,
I hope someone could help a newbie out or point me in the right direction.
I got a pretty simple setup with a main swf that loads in external swf trough an array… I created a “next” and “prev” button - attempting to load the next or previous external swf from that array…
Next function is working but previous function is not really.
(on first click it doesn’t do anything - and then error messages)
I have no idea why… been trying every modification i can think of to the code but no luck…
Here my code:
var clips:Array = ["a.swf", "b.swf", "c.swf"];
var index:int = 0;
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 prevClip():void {
thisLoader.load(new URLRequest(clips[index]));
}
function doneLoading(e:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
stage.addChild(thisMC);
thisMC.play();
}
btnNext.addEventListener(MouseEvent.CLICK, playNext);
function playNext(e:MouseEvent):void {
nextClip();
index = (index + 1)%(clips.length);
}
btnPrev.addEventListener(MouseEvent.CLICK, playPrev);
function playPrev(e:MouseEvent):void {
prevClip();
index = (index - 1)%(clips.length);
}
Please Help…
Thank you so much in advance guys.
:hr: