views:

390

answers:

1

I have a Flash program that loads AS2 and AS3 SWF files dynamically with the same function. I'm trying to convert all the AS2 files to AS3, but I don't have the FLA for some, so they will need to remain AS2.

What I need to do is if the file getting loaded is AS3, I need to run an additional set of code to setup some interactive features. If it's AS2, I just want to load it.

What would the code be for checking to see if a dynamically loaded SWF file is AS2?

Thanks


Update. It looks like the actionScriptVersion is what I'm looking for, but it's not working the way I expected. I have in my code:

trace(loader.loaderInfo.actionScriptVersion);

But when I try and load a file I know is AS2, I get 3 instead of 2. Am I using this code incorrectly?

+1  A: 

Check the actionscriptVersion property of the loaded content's loaderInfo property:

http://livedocs.adobe.com/flex/2/langref/flash/display/LoaderInfo.html#actionScriptVersion

quoo
That looks like exactly what I'm trying to do, but it's not working correctly for some reason.
Ryan Smith
You want loader.content.loaderInfo.actionScriptVersion or contentLoaderInfo.actionScriptVersion. The loader is in the AS3 swf, so it would be as3!
quoo
Killer! You rock. Thanks.
Ryan Smith