Skip to main content
Known Participant
March 24, 2013
Answered

Problems with imported SWF

  • March 24, 2013
  • 1 reply
  • 543 views

I have imported a SWF into my flash project but when I play the swf file it works but when I go to another scene, the swf file stays on the other scenes. This only happens when I open the scene which the swf file is in. I am using the following Actionscript to load the swf.

var myLoader:Loader = new Loader();

var url:URLRequest = new URLRequest("Simulator2.swf");

myLoader.load(url);  

addChild(myLoader); 

myLoader.x = 185;

myLoader.y = 35;

Could anyone help? thanks!

This topic has been closed for replies.
Correct answer Ned Murphy

When you load content dynamically it does not have a home in the timeline unless you plant it into something that you have manually placed there.  If you create a blank MovieClip in the scene/frame where you want this file to appear, then you can add the loader as a child of that MovieClip so that it has something to anchor it to the timeline.... as in...

blankMCName.addChild(myLoader); 

instead of

addChild(myLoader); 

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
March 24, 2013

When you load content dynamically it does not have a home in the timeline unless you plant it into something that you have manually placed there.  If you create a blank MovieClip in the scene/frame where you want this file to appear, then you can add the loader as a child of that MovieClip so that it has something to anchor it to the timeline.... as in...

blankMCName.addChild(myLoader); 

instead of

addChild(myLoader); 

shas95Author
Known Participant
March 25, 2013

Thank you, got it working.

Ned Murphy
Legend
March 25, 2013

You're welcome