[swfmill] Accessing frames in AS3
Joel Poloney
joel at poloney.com
Mon Nov 12 10:52:34 PST 2007
> create a MovieClip in your swf and create the frames that you'll want to
> access in that swf.
>
> Load the swf in and create a new instance of the MovieClip with your
> accessible frames in.
>
> for instance if your clip is called 'FramesClip' - and is being exported
> for actionscript - it is automatically (in the Flash IDE and Flex, anyway)
> compiled into a Class that extends MovieClip, so you can instantiate it with
> 'new' as you would any other class.
>
> haven't tested this at all but this is the process.
>
> var context:LoaderContext = new LoaderContext( false,
> ApplicationDomain.currentDomain )
> var loader:Loader = new Loader();
> loader.addEventListener( Event.COMPLETE, handleLoadComplete );
> loader.load(new URLRequest( "framesclip.swf" ), context );
>
> private function handleLoadComplete(event:Event):void
> {
> var ClipClass:Class = getDefinition("FramesClip") as Class;
> var clipInstance:MovieClip = new ClipClass();
>
> addChild(clipInstance);
>
> clipInstance.gotoAndPlay("whatever");
> }
>
> In this case i've loaded the other swf into the same ApplicationDomain as
> the swf that's loading it. That's not necessary, but you'd have to get the
> definition from the Loader's ApplicationDomain if you don't.
>
Interesting news about the changes to AS3. Alright, so I understand the
process, but are you saying that I should name the movieclip as "FramesClip"
when I compile it in swfmill? Is there a way I can utilize the event:Event
var in the handleLoadComplete function when creating the ClipClass? I
noticed that you use this var at all. I guess I don't really understand the
getDefinition line of your callback function. Can you explain this a little
better?
> What other AS3 compilers are there?
The haXe compiler will compile AS3 if I'm not mistaken.
Thanks again!
-- Joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/swfmill_osflash.org/attachments/20071112/b6e4fac2/attachment.html
More information about the swfmill
mailing list