Changing AIR SDK in FlashDevelop can be a daunting task if you have never done it before. It certainly has been for me when I wanted to switch from AIR 3.9 to AIR 4.0. So I resolved to write a step-by-step guide to help people like me who have never switched AIR SDKs before and at the same time to have a handy reference for myself when it comes to upgrade AIR SDK again.
In this tutorial I am using the latest development build of FlashDevelop which you can download for free here:
FlashDevelop-master.exe if you want to install FlashDevelop on your computer.
FlashDevelop-master.zip if you want a stand-alone version of FlashDevelop.
STEP 1 – Download & Install SDK(s)
Once you have successfully installed FlashDevelop on your computer, let’s proceed to download the new AIR SDK.
In the Tools menu choose Install Software… (Tools > Install Software…)
This will pop-up a window called AppMan where you can select a number of SDKs and other useful things to download, install and use in FlashDevelop.
Check all the relevant SDK boxes and click on the Install button in the bottom right corner.
Checking Flex+AIR SDK will download, install and merge the two SDKs (Flex and AIR). Using this option for compilation will make FlashDevelop use the ActionScript Compiler 1 (ASC1).
Checking AIR SDK + ASC 2.0 will download and install the latest AIR SDK. Using this SDK to compile will result in compiling with the ASC2.
About the ActionScript Compiler (ASC)
Written in Java, and distributed as a Jar file (asc.jar), the ASC allows to compile *.as source code to an *.abc file (ActionScript Byte Code), or to a *.swf file, or to an executable file.
The ActionScript Compiler 2.0, or ASC2, has been introduced as part of the AIR 3.4/Flash Player 11.4 SDK preview and Flash Builder 4.7 Preview. ASC2 is now distributed with Flash CC (Flash C++ Compiler) and the AIR SDK (since AIR 3.6).
Learn more about ASC 2.0 and the differences between ASC 1.0 and ASC 2.0 here: http://www.bytearray.org/?p=4789
STEP 2 – Edit SetupSDK.bat
Let’s restart FlashDevelop and check that the SDKs we have just downloaded have been correctly installed and registered in FlashDevelop.
Choose Tools > Program Settings > AS3Context > Installed SDKs and you should see the SDKs you have just installed in this list.
While we are looking at the Installed Flex SDKs, let’s click on the little button with 3 dots […] next to InstalledSDK Array.
A new window will pop up:
Let’s take note of our SDK’s path (in this example: C:\Program Files\FD\Apps\flexairsdk\4.6.0+4.0.0) .
Now let’s open bat/SetupSDK.bat and make sure we are using this path for FLEX_SDK:
:: Path to Flex SDK set FLEX_SDK=C:\Program Files\FD\Apps\flexairsdk\4.6.0+4.0.0
STEP 3 – Edit Your Project’s Properties
From the Project menu choose Properties… (Project > Properties…)
In the Output Tab, where it says ‘Platform’, select the SDK version you want to use.
In the SDK tab select the SDK you want to use:
Finally in the Compiler Options tab, expand the Additional Compiler Options and add:
At the time of writing the latest SWF version is 23, but obviously this will increase with future versions of the runtime. For a complete list of SWF version numbers see here: http://www.adobe.com/devnet/articles/flashplayer-air-feature-list.html
Check your compiler version (optional)
While we are here, we can perform a quick test to double check if we are using ASC 2.0. Just add:
to the list of Additional Compiler Options and if you get no error messages during compilation complaining about the -inline parameter then you are successfully using ASC 2.0. This is because the inline functionality is only implemented in ASC 2.0 and not in ASC 1.
STEP 4 – Edit Your Application Descriptor
In your application descriptor (application.xml) change application xmlns to reflect the AIR SDK you are using (in this example 4.0):
That’s it, now you should be able to successfully compile your project with the AIR SDK of your choice!
I hope you found this tutorial useful, please feel free to ask questions or add your feedback in the comments section below.
If you are interested in my random ramblings and philosophical disquisitions you can follow me on twitter @framais
Thanks for reading!