PDA

View Full Version : Call A Method From An AS3 SWF That Has Been Loaded Into Flex


brixel
05-21-2009, 12:47 AM
Hey guys,

I have a simple AS3 SWF built with the Flash authoring environment, and has one method in it, "Test()". In Flex 3 I have a SWFLoader which loads this SWF in.

My problem is I want to be able to call the "Test()" method, but it keeps erroring on me with #1069.

I've seen a few examples where people did it like:


mySWFLoader.content.Test();


But that won't compile, errors out.

I've also tried casting it - MovieClip( mySWFLoader.content ).Test() - , but that's when I get the error above. Can anyone point me in the right direction here? Seems like this should be simple. Thanks.

mattb
05-26-2009, 03:55 PM
Checkout the EmbeddedLibrary class from Transmote, well documented by gskinner: http://www.gskinner.com/blog/archives/2007/03/using_flash_sym.html

brixel
05-26-2009, 07:15 PM
Thanks Matt,

I found out that I could call the method rather easily once I got rid of the @Embed - for some reason when I embed it, it fails, but if I just point to it with the SWFLoader I can call the method as state above. I will take a look at the link you provided, but just wanted to point that out. Thanks.