views:

872

answers:

3

Is this possible? I would like to have a main swf that can be viewed by users who either have flash 9 or flash 10 installed. Inside of this swf, a separate module will be loaded only for users who have flash 10 installed. This module will use some advanced flash 10 features.

A: 

It's a long time since I don't develop flash apps but well... these are my 2 cents:

You might have to compile the main Flash to 10 and this can be a problem because of the upgrade warning.

This is a possible workaround: http://codeofdoom.com/wordpress/2009/02/09/compiling-to-flash-10-requiring-flash-9/

Having done that, I think that it's easy detecting the flash version and loading different swf modules just like you say.

ktulur
+1  A: 

Sure, this should work fine just as you've described it. Make your base SWF in Flash 9, do a version check, and optionally load in another SWF published as 10. Flash will render the advanced features in the v10 SWF, regardless of the version of the SWF it was loaded into.

Just remember that the version is returned as a String, so be sure to do a parseInt on it.

fenomas
A: 

This should work fine unless you're trying to use Flash 10 specific libraries in the Flash 10 SWF, which is probably what you're doing. I just tried this out, and yet again Adobe disappoints in their Flash/Flex library design and quality.

For example, I was trying to do the following

I have a Flash 9 base SWF which will load up a Flash 10 module, if the user's Flash Player is 10 or greater. This Flash 10 module ends up using the Flash 10 specific libraries, like: 1) flash.net.NetStreamPlayOptions 2) flash.net.NetStreamPlayTransitions 3) NetStream.play2 Unfortunately, when I do this, the Flash runtime complains that there is no such thing as NetStreamPlayOptions, NetStreamPlayTransitions, and NetStream.play2. I tried to get around this by duplicating the NetStreamPlayOptions and NetStreamPlayTransitions, which got me farther, but unfortunately I was unable to call NetStream.play2, even if I cast the NetStream instance as an Object.

I believe it works like this because the base SWf, which is Flash 9, uses the playerglobal.swc, intended for Flash 9. When it loads up the Flash 10 SWF, it still ends up using the Flash 9 playerglobal.swc because the environment was initialized for Flash 9, which causes problem with the Flash 10 SWF. I have yet to find a way around this.

When Flash was switching from AS1 -> AS2 -> AS3, it made sense why it wasn't backwards compatible, but now AS3 cannot always load AS3, which in my opinion is very disappointing.