Exporting for iPhone using Air 2.7 and FlashDevelop – Part One, Installation.
With the recent release of Air 2.7 Adobe has stepped up the performance of Flash on the iPhone, so here’s a quick guide on installing the new SDK for use with FlashDevelop.
Be a Lazy Coder with FlashDevelop.
If you use a lot of AS3 and have never tried FlashDevelop before then you don’t know what you’re missing out on. Someone once said that a lazy coder is the best sort of coder, and with FlashDevelop your level of laziness can truly soar! But lazy doesn’t mean writing bad code, quite the opposite, lazy means not wasting time on the no brainer stuff that is laborious and repetitive or just plain below us as humans – that’s what computers are for! And that’s just what FlashDevelop is good for. I could go on about all the great code completion and productivity features of FD, but you won’t truly understand until you give it a go yourself.
You can grab FlashDevelop from their site (it’s open source): http://www.flashdevelop.org/wikidocs/index.php?title=Main_Page
So assuming you have FlashDevelop installed and are reasonably familiar with it, lt’s go ahead and set things up.
Merging Flex and AIR SDKs.
The first thing to note is that this set up will be for a project compiled by FlashDevelop (not a Flash IDE project). If you’re still using Flash to do your compiling it might take a little getting used to but with the use of an SWC to hold your library items you can set yourself free from the main timeline and use FlashDevelop to do the magic for you. The advantages of this is that you’ll have faster compiles (as FD doesn’t need to repackage all of your library items with each compile) and you can for the most part have a very clean separation between your code and your graphics.
I’d suggest downloading the latest Flex SDK from Adobe so you can start with the latest and greatest: http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK The latest version is currently 188.8.131.5228
Once it’s downloaded, unzip the file to a folder on your harddrive where you will point FlashDevelop to.
Next download the Air SDK: http://www.adobe.com/products/air/sdk/ The latest version is currently 2.7
Unzip the Air package, and then you need to merge it with the Flex SDK files you’ve just downloaded. What this means is that you copy all of the files from the Air package into the folder of the Flex SDK so that all the newer files and overwrites come from the Air side. Trusting in the Windows Gods this is just a matter of going into the Air folder, selecting all and copying, then going in to the Flex Folder and pasting. Windows will ask if you want to overwrite and you can say yes. This will keep all of the Flex files that are in those folders if there aren’t newer versions in the Air SDK. Fingers Crossed.
Pointing FlashDevelop to the SDK files.
Next we need to point FlashDevelop to the our new hybrid Flex/Air SDK location. You can do this on a per-project basis, or the way that we’re going to do here which is globally, so that by default every project you use will compile with this particular SDK. Open up FlashDevelop and go to Tools>Program Settings (or you can just press f10). On the left hand column you want to select AS3Context and you’ll see the right hand side will open up with a series of options. In the Language section there will be a “Flex SDK Location” property. This is where you want to point FlashDevelop to your SDK folder, so click on it and browse to the location where you made your AIR/Flex Hybrid. You want to select the folder that contains the ant, asdoc, bin folders etc. and press OK.
An so now you’re ready to compile using FlashDevelop and AIR 2.7! In Part Two we’ll set up FlashDevelop to create an iPhone project that will generate an IPA file of your swf.
Part 1 – Installation
Part 2 – Creating an iPhone Project
Part 3 – Generating Developer Certificates, Provisioning Profiles and .p12 Files
Part 4 – Creating an Air Certificate and Compiling to .IPA
Part 5 – Loading your .IPA File onto a Test Device