import flash.display.MovieClip;
import flash.display.Stage;
import flash.display.Loader;
import flash.net.URLRequest;
stop();
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, CreateCG_POST_LOAD);
loader.load(new URLRequest("TestMovieClip.swf"));
function CreateCG_POST_LOAD( e:Event ):void{
var newMC:MovieClip = MovieClip(loader.content);
stage.addChild(newMC);
newMC.gotoAndStop(4); //seemingly does nothing
trace("currentFrame " + newMC.currentFrame); //outputs 1, should be 4
trace("totalFrames " + newMC.totalFrames); //outputs 1, should be 4
}
The above code appears on frame 1 (of the stage) of my test project.
TestMovieClip is only 4 frames, with NO AS3 code.
I created TestMovieClip.swf by right-click (in library) -> 'Export SWF...'
GOAL: I would like to load an external swf and treat it as a MovieClip. I want to be able to navigate to specific frames.
RESULT: The clip appears, but plays on an endless loop. The trace output seems nonsensical.
I discovered that the MovieClip is created WITHIN loader.content as a child object.
I was able to reach it with this: