The last comment here : http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html looks quite relevant to my question as far as I can tell :
<quote> Even better would be if I could use expressions in the conditionals themselves, so that I could write in my code: SECRET_NAMESPACE::target-player==9 private function .... SECRET_NAMESPACE::target-player==10 private function... Let's hope that this will be made easier in the future. And if that super secret namespace exists and someone knows about it, please post it here. </quote> I'm getting a bit more tempted to go another way whilst I still only have an hour or so's (not uninteresting, mind you) work to write off though! -----Original Message----- From: flexcoders@yahoogroups.com on behalf of Jim Hayes Sent: Mon 05/01/2009 23:31 To: flexcoders@yahoogroups.com Subject: [flexcoders] Can I detect the flash player version targeted by the compiler ( -target-player ? ) in my code Apologies if this is a stupid question, but it's late, I'm tired and all out of brain cells :( I have an application with largely common code base that gets compiled to both AIR 1.5 (e.g. flash player 10) application and flash player in a web browser. I keep a separate flexbuilder project for both, each project shares the common code as an external code path. Normally I'll just use FB for debugging, to compile a release I'll use ANT to pull in varying resources as necessary. I now wish to add some flash player 10 features (pixel bender, specifically) to the AIR app, but keep the online flash player version wholly flash player 9 compatible. I'm not yet ready to serve up a different .swf based on the users player version, I'm afraid, though I am thinking about it. So, I've implemented a factory class to provide the relevant classes according to the target, but can't quite put my hand on what I should test for. Capabilities.version gives me run time info about the player version that the user has, but not what the swf is compiled for. What I'd really like is the player version targeted by the compiler (either by the compiler argument -target-player or flexbuilder "require flash player version" , if they are different.) I'm quite tempted to add my own -define argument to the compiler since I'm fairly sure that will do what I require, but if there is something already there that I can use then I'd prefer to do so. were I to go with my own define it would look something like this : compiler argument something like -define=PLAYERCONFIG::ISPLAYER10,true and in the factory something like this : var imagingClassName:String = "Flashplayer9compatibleClass"; PLAYERCONFIG::ISPLAYER10 { imagingClassName = "Flashplayer10compatibleClass"; } // myClass:object = getClassBydefinition(imagingClassName ), return new myClass() etc etc Failing that, I can still achieve my aim by taking the factory class out of the common code for each project and writing an implementation for each version, but I was quite keen to go down the conditional route in this instance. Many thanks in advance for any advice (comments to rtfm are very welcome if they come complete with a url or a good hint as to where :) ). I'm not totally convinced that I'm even heading in the right direction here tbh, but at least if I knew how to do this then I could try it out for size. ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________ ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________
<<winmail.dat>>