This content has been marked as final. Show 3 replies
Using the parameters property of the Application is the best way if you are passing in parameters to the loading SWF:
<mx:SWFLoader source="something.swf?var1=value1&var2=value2&var3=value3" />
The something.swf can get to the var1, var2, and var3 values using the parameters property of its Application tag.
Thanks for your good way.
I had expected such method only worked with object and embed tags. It's amazing that it should work with SWFLoader too. Actually, I have another question. I want to listen to some event of child swf (mainly a init complete to notify the main swf it has constructed completely and prepared itself well.) As you know i can not reference child swf in SWFLoader complete event, so what is the proper time i call the addEventListener() method?
The SWFLoader's complete event is fired once all of the bytes have been read which means there is still some activity to go.
If the SWF you are loading is another Flex 2 SWF, you can use its creationComplete event to call a method in the main application.
Application.application refers to the top-most application; parentApplication refers to a UIComponent's immediate parent Application.
In the loading SWF you can use Application.application. someFunction() and that function can dispatch an event or do whatever you need.