I recently started looking into how to package an Flash based game in AIR, and surprisingly there is a lack of straight forward tutorials on the matter. Thankfully, the whole process is actually quite simple! So here’s a little tutorial on getting started for Flex users making games in FlashDevelop. You’ll also need the latest version of Adobe Air.
Standalone Executable
You’ll want to create a new project, specifically an AIR AS3 Projector.
Once you’ve created the project, you’ll end up with a familiar project template with the exception of the included bat files. Simply copy and paste your “src” folder from your other project into the new one your just created.
You should now be able to compile and run the project with no problems! Yes, it’s as easy as that. However, you’ll want to read further as there are a few more steps to actually packaging the project into an air file.
You will want to go into the “bat” folder and open up the “SetupApplication.bat” file. Here you’ll want to change the “CERT_PASS” value to something else besides the default value.
Next you’ll want to open up the “application.xml” file in the project root. There you can change the options such as the window title and such. If you rename your swf, you’ll also need to come here and change the file name and ID.
Once you’ve done that, right-click on the “CreateCertificate.bat” and click “Execute”. This will create a certificate which you’ll need in order to package your application. Next, execute “Packager.bat”. This will create a new directory called “air” which will contain your application packaged as an Air file! This is the file you’ll want to distribute to people.
Android App
Making an Air application for the Android platform is essentially the same method as above, with a few exceptions.
You’ll want to create a new Air Mobile AS3 App.
You’ll want to use the same method outlined above for creating your certificate.
However, if you open up the “Run.bat” you’ll see that there is a bit more options that you can fiddle with. The most important ones to take note of are the ones under the “target” label which instructs the batch file which platform you are packaging the app for. To change platforms, simply uncomment the one you want and leave the rest commented. By default, the desktop platform should be uncommented. This runs the app just as it would in a standard AS3 project.
In order to test the app on an Android device, you’ll need to have the SDK, the OEM drivers for the device, and the device to test on. You’ll also need to turn on the USB debug feature. To do this, go to Settings > Applications > Development and enable USB debugging (on an Android 4.0 device, the setting is located in Settings > Developer options). You can read more into this here.
Once everything is set up, you can uncomment the “::goto android-debug” line. When you compile and run your app, flash develop will essentially install the app on your phone for you to test.
You also should be aware of the available screen sizes, which is found under the “desktop” label. By default there are only two, with the NexusOne line uncommented. However, you can find more screen sizes in the comment just under the label.
I unfortunately do not own any iOS devices so I can’t share my knowledge on that topic, but there is a great tutorial here which covers the process.
Other than that, your app is ready to go! Hopefully this tutorial has made figuring out the first few steps of packaging an Air application much easier for you than when I was poking around with it by myself.
Great help, thanks