R – Dynamically Loading AS2 file in AS3 – how to tell if the file is AS2

actionscript-2actionscript-3flash

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?

Best Answer

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

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

Related Topic