How can one pause/resume a dynamically loaded external SWF file using ActionScript 3?
-
09-09-2019 - |
Question
I'd like to be able to play/pause dynamically loaded external SWF movies using ActionScript 3.0. Any help is appreciated. Thank you.
Solution
The loaded SWF's are accessible through the Loader's content property. You can cast the content property to your loaded SWF's Document Class to access methods of your SWF directly. Of course you can simply use the play(); and stop(); ... if you just want to play time-line animations :
var loader:Loader = new Loader("anim.swf");
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(e:Event):void
{
var movie:MovieClip = e.target.content;
movie.play();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow