I'm writing an universal graphics engine that will work on FP11 using molehill advantage and also works in FP10 using old software blitting.
So, I'm woundering what is the best way to achive this?
First I thought that if I will compile swf for FP11 and will not use new classes if the version of player is not 11, everything will work fine. But I was wrong. To my surprise I'm getting "VerifyError: Error #1014. Couln't find class flash.display3D::Context3D" error if I run code with imported FP11 libraries even if they are not called.
I thought FP will throw this message only when I will try to access an absent class, but that is not right. It throws error just when I'm trying to run .swf
So, is there any way to do it? I thought of loading different SWFs depending on the version using preloader, but maintaining and compiling 2 different SWFs is quite confusing.
Are there any other ways?
If you're using Flash (as opposed to Flex or some other tool), your only option may be conditional compilation, I believe. When I had to deal with this in CS5, I couldn't find anything else.
What I ended up doing was I defined several constants for the various configurations and then I compiled several versions of the .swf. I loaded the right .swf file based on player detection code in the browser. It's really a mess if you want your .swf on places like Newgrounds, etc.