I have a flash project (AS3) that I am developing using Flash CS6. I am developing for iOS devices, Android devices, desktop (air) and web browser (swf). So far I have been able to use a single codebase making only a few modifications when publishing to each for example -
I have some code that handles exiting the application on a mobile device when the user presses the home button that uses the flash.desktop.NativeApplication class. Obviously this is not needed for the desktop or for the swf version so when i come to publish for these I comment out the relevant import statements and code that listens for the home button being pushed.
I also have a config.xml file that loads some settings, for swf this is not in the same directory as the swf file so pass in the location of this config file when the swf object is loaded (flashvars). But for all other versions the path to this file is simply config.xml so I comment out the code that handles the loading of flashvars -
allFlashVars = LoaderInfo(this.root.loaderInfo).parameters;
webroot = String(allFlashVars["webroot"])
There are a few other differences between the versions that requires similar steps which I have made sure to note in a document for myself to remember and for other developers.
However I know that this is not the ideal solution and think there must be a better way to manage this.
Does anyone know of any good advice / best practice for handling such a situation?
thanks