• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

In Flash ActionScript 3, How to Stop a newly-loaded SWF file from playing automatically?

In ActionScript 3, the following script loads an external movie clip (swf file), and plays it automatically:
 
var mc:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("SomeMovieClip.swf");
mc.load(urlReq);
addChild(mc);  

How can I prevent the newly loaded SWF file from playing automatically, and instead have it go to frame 1 and stop?
0
HarmonyClaire
Asked:
HarmonyClaire
1 Solution
 
HarmonyClaireAuthor Commented:
I solved the problem myself finally, you have to trap for the "initialized" event, and then stop the movie within that  event function.

//Load movie
var urlReq:URLRequest = new URLRequest("SomeMovieClip.swf");
var mc:Loader = new Loader();
mc.contentLoaderInfo.addEventListener(Event.INIT, doneInitializing);
mc.load(urlReq);


//Script to run after movie load is initialized
function doneInitializing(evt:Event):void {
  addChild(mc);  
  mc.content.stop();
}
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now