Hi All…
I am loading an external SWF file on button click, however, when the external SWF loads, it covers the buttons… Can someone please help me on how I can keep the buttons on top? I even tried lading the External SWF into a Movie clip and putting the buttons on a layer above it - and it doesn’t work… Any help would be super appreciated… Thank you ahead of time!!!
This is my code:
// Array of external clips to use. Variable index refers to next clip to be displayed.
var clips:Array = [“page1.swf”, “page2.swf”, “page3.swf”];
var index:int = 0;
// Stuff to load swf 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 can be generic
// Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
function nextClip():void {
thisLoader.load(new URLRequest(clips[index]));
}
// Tell AS that the loaded file is a movie clip and add it to the stage.
function doneLoading(e:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
stage.addChild(thisMC);
thisMC.play();
}
// “Next button” just calls a function that goes to the next file name (mod the number of files in the list)
bttn1_mc.addEventListener(MouseEvent.CLICK, playNext);
function playNext(e:MouseEvent):void {
nextClip();
index = (index + 1)%(clips.length);
}
stage.addChild(bttn1_mc);
bttn1_mc.visible = true;