Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Feb 03, 2013 Feb 03, 2013

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!

TOPICS
ActionScript
487
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Feb 04, 2013 Feb 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2013 Feb 04, 2013
LATEST

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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines