[swfmill] Accessing frames in AS3

Trevor Burton trevor.burton at virtuefusion.com
Mon Nov 12 11:12:27 PST 2007


it'll compile to AS3 bytecode... but you have to write haxe code - so it's not technically compiling AS3 (unless i'm mistaken, and i'm splitting hairs anyway, i know what you mean:)
 
-------------------------
Trevor Burton
Flash Developer
VirtueFusion
14-16 Betterton Street
London, WC2H 9AH
t: 0207 420 6420
m: 07954 239 024

________________________________

From: swfmill-bounces at osflash.org on behalf of Joel Poloney
Sent: Mon 12/11/2007 18:54
To: swfmill at osflash.org
Subject: Re: [swfmill] Accessing frames in AS3


Sorry, sent this with an email not registered on the list.





	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 --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5426 bytes
Desc: not available
Url : http://osflash.org/pipermail/swfmill_osflash.org/attachments/20071112/fc3a7a0f/attachment.bin 


More information about the swfmill mailing list