Skip to main content
Participant
February 4, 2013
Question

How can I put a movieclip on top of a loader-embedded SWF?

  • February 4, 2013
  • 2 replies
  • 503 views

Hi there,

I am using AS3 and this is my code to load a SWF gallery onto my flash site:

var myLoader:Loader = new Loader();  myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showMySWF); function showMySWF(e:Event):void { addChild(myLoader); myLoader.x=100; myLoader.y=150; myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, showMySWF); }  myLoader.load(new URLRequest( "xmlgallery.swf" ));

I have some movieclips that I want to place on top of a corner of the SWF. I have tried everything from reordering layers and even this handy script:

setChildIndex(mc_name, numChildren-1)

The above script works if you want your movieclip to appear on top of other movieclips. But it does not work if you want it to appear on top of an embedded SWF.

Can anyone show me the way I can do this? Thanks!

This topic has been closed for replies.

2 replies

Participant
February 4, 2013

Just want to throw out there that besides using actionscript to reorder the objects, there is one other way. I simply put the loader actionscript I mentioned above in a movieclip instead of the actionscript on the main timeline. And tada! It is now under the object (which is a rose) that is part of the main timeline (on its own layer).

Inspiring
February 4, 2013

To place a MovieClip in front of a loader, you have to wait until it is actually added to the display list.

So you would use sth like:

setChildIndex(mc_name, stage.numChildren-1)

after your

addChild(myLoader)

executes.