View Full Version : Running AS2 SWFs Inside SWFLoader
11-18-2009, 11:31 AM
I have an application that showcases various Flash works built in Flex 3. After clicking a thumbnail, the SWF is loaded into a SWFLoader. This all works, however, depending on the code used in the original SWF, mostly AS2 SWFs, various problems occur in the Flex application, I'm guessing because root is being targeted or the global space is being used.
Is there a way to prevent code being executed in external SWFs like this from intruding on my Flex application, keeping it in a bubble so to speak?
11-18-2009, 02:45 PM
Ok, I've dug further into the issue and it appears what is happening is that after calling the unloadAndStop for the SWFLoader, additional calls to set the source of the SWFLoader result in a new SWF being loaded, but it is not visible, you can only hear audio.
11-18-2009, 09:30 PM
If my memory is not playing tricks on me then the loaded swf files are automatically played if not specified differently ( even if you do not add them to the display list... in the background, they are still playing and doing their stuff ).
You should be able to tell the SWFLoader not to automatically play the loaded content but I can't remember the exact property/method name at this hour. Still, this is not a guarantee that your problem is solved... although the loaded swf file might not play automatically, I'm not sure if that also means that it won't be initialized... in case it just stopped but also initialized and your audio logic ( the part where you load and play sounds ) is also called during the initialization, then you might still hear the audio.
Unfortunately, that's all I can help you with without actually being able to see what you have there ( maybe if you upload some files then we could be of more help ).
11-19-2009, 06:29 AM
You may write an SWF that will never unload once loaded, and there isn't a way to absolutely prevent that from the loading SWF. Even worse is that it is usually more difficult to make SWF that will unload then the one that won't.
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.