Access properties of loaded SWF file in Flex

13 04 2009

I had a requirement of loading a Flash CS3 SWF file into my Flex application and access its properties. I tried to follow the recommended way using the SystemManager class by Adobe.

This did not work for me. The file loaded but when I tried to access the properties of the loaded SWF, it always gave me an error.

I discussed this with my colleague, Sumant Mishra. He gave me a simple hack which actually worked like charm. Check out the code below:

private function onSWFInit(e:Event):void
	var fl:FlexLoader = as FlexLoader;
	var loadedSWF:* = fl.getChildAt(0);
	loadedSWF.init(); //init() funciton is on the main timeline of loaded SWF
<mx:SWFLoader id="previewLoader"



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: