Skip to main content
Participating Frequently
September 12, 2011
Answered

Can't play SWF on timeline after AS3 import

  • September 12, 2011
  • 2 replies
  • 1242 views

A helpful YouTube video showed me how to import my SWF onto the stage.

var bgLoader:Loader = new Loader();       // create a new instance of the Loader class
bgLoader.load(new URLRequest("mymovie1.swf"));     // load the SWF file
mc_name.addChild(bgLoader);    // add that instance to the display list
bgLoader.x = 0;                                      
bgLoader.y = 0;

My  only issue now is that although the SWF plays when I test the movie, it  doesn't play directly on the stage when I press the timeline's Play  button. Is there a way I can get the SWF to play using the Play button? I'd prefer to see the SWF so I can add overlays. Thanks.

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

The dynamically loaded swf is not available until you test the movie and the code is compiled/executed.  Code is not executed if you are just scrubbing/playing the timeline.

2 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
September 12, 2011

The dynamically loaded swf is not available until you test the movie and the code is compiled/executed.  Code is not executed if you are just scrubbing/playing the timeline.

kglad
Community Expert
Community Expert
September 12, 2011

no, you won't be able to see that loaded swf playing in the ide.

however, you could comment-out your loading code, create a new layer on your main timeline, click file/import/import to timeline and select mymovie1.swf.

you should see a sequence of keyframes that correspond to the main timeline of your imported swf.  if all the animation in that swf takes place on the main timeline, you should be able to use that for your overlays.

when you're done, delete that layer and uncomment your load code.  you will then probably want to use stop() on your main timeline until loading of mymovie1.swf is complete.

RonL2kAuthor
Participating Frequently
September 13, 2011

Thanks for all replies. The temporary import workaround sounds intriguing. I'd already tried directly importing the SWF to the stage but found that all Actionscript within the SWF was ignored. In addition, I didn't like the messy number of objects the direct import added to the library. Is there a way to cleanup the library from that onslaught of objects?

kglad
Community Expert
Community Expert
September 14, 2011

yes, shift-click to select a span of objects.

if you keep a tidy library with all your objects in folders then it's especially easy to delete all the graphics generated by importing.