# External SWF loads over buttons

**URL:** <https://forum.kirupa.com/t/external-swf-loads-over-buttons/312144>\
**Category:** flash\
**Created:** [July 26, 2010, 10:53pm UTC](https://forum.kirupa.com/t/external-swf-loads-over-buttons/312144 "2010-07-26T22:53:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lanawylma](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@lanawylma](https://forum.kirupa.com/u/lanawylma)\
**Post date:** [July 26, 2010, 10:53pm UTC](https://forum.kirupa.com/t/external-swf-loads-over-buttons/312144/1 "2010-07-26T22:53:42Z")

</div>

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;
