IntelliJ IDEA 12.1 has complete support for the Adobe Gaming SDK, i.e. Adobe AIR SDK bundled together with Away3D, Starling and Feathers frameworks. In this tutorial you'll get step-by-step instructions on how to set up, build and run sample applications included in the SDK.
We assume you have Adobe Gaming SDK installed on your computer and IntelliJ IDEA 12.1 (or later) is running. Samples included in the SDK are shipped with Flash Builder project files (.project, .actionScriptProperties, etc.), and this makes setting up an IntelliJ IDEA project quick and easy, because IntelliJ IDEA is able to import a Flash Builder project in just a few clicks.
|If you are new to IntelliJ IDEA but have experience with Flash Builder or other Eclipse-based products, there are some differences in terminology that you should keep in mind:
IntelliJ IDEA Flash module contains one or more Flash build configurations. A build configuration is a set of parameters that define how to produce SWF or SWC, HTML wrapper or AIR descriptor, Desktop, Android or iOS package from the module source.
To import a single Flash Builder project, select File | Open... or click Open Project on the IntelliJ IDEA welcome screen. Then in the file chooser select a .project file, e.g. [SDK]/Samples/Away3D/Invawayders/.project. If you decide to import a single project, you will skip step 2.
To import multiple projects, select File | Import Project... or click Import Project on the IntelliJ IDEA welcome screen. Then in the file chooser select the base folder to search for projects in: [SDK]/Samples
At the next step select Import project from external model and Flash Builder.
Leave the defaults at the next step.
Now you can choose which projects to import. Let's keep them all.
If you have Flash Builder installed on your computer, IntelliJ IDEA will automatically select Flex or AIR SDK from the Flash Builder installation. Otherwise you'll be asked to select SDK manually.
Click [...], at the next dialog click [+], select Flex/AIR SDK on the popup, and then select the path to AIR SDK bundled with Adobe Gaming SDK: [SDK]/AIR SDK/air3.5_p5_sdk_asc2_win_011013.
Now all samples are imported and ready to be started. But first let's explore the structure of the IntelliJ IDEA project we just created (the Project Structure button on the main toolbar).
- At the bottom you will see a list of errors, the reason being that keystore and provisioning profile paths were hard-coded in the Flash Builder project. When you decide to launch some app on the real device, you'll need to fix them (click the arrow icon to the right to navigate to the field with the error).
- If you are new to IntelliJ IDEA, we suggest looking through all build configurations and all tabs just to get used to IntelliJ IDEA settings.
- Two things to fix in StarlingTemplateMobile module: disable iOS support for Scaffold_Android build configuration and disable Android support for Scaffold_iOS build configuration. Flash Builder doesn't allow you to select supported mobile targets per app (only per project) - that's why this was not imported automatically.
- If you were not asked to select SDK manually (step 3), that means that IntelliJ IDEA has found a suitable SDK in the Flash Builder installation and has configured it (as is the case on the screenshot). You may keep it as is, or you may change it to AIR SDK from the Adobe Gaming SDK - just click New... button next to the Flex/AIR SDK field on the Dependencies tab.
- In any case we suggest that you configure documentation URL for the SDK. Having the URL, IntelliJ IDEA will fetch documentation automatically when you invoke 'Quick documentation popup', use code completion, etc. To do so, click the Edit button next to the Flex/AIR SDK field, select Documentation Paths tab, click Specify URL button and then OK (correct URL is already preselected). Alternatively, you can download the docs and configure a local path.
Look through the Run configurations created by IntelliJ IDEA (Run | Edit Configurations...). Flash run configurations have different options depending on the target platform of the build configuration on which run configuration is based: Web, Desktop or Mobile. You don't have anything to fix here; the purpose of this step is just to understand that you can configure the following:
- where to launch a Web-targeted app: OS default app, browser or standalone Flash Player;
- where lo launch a Mobile app: Emulator, iOS Simulator, Android device, or iOS device;
Coding assistance is the strongest feature of IntelliJ IDEA. It includes code highlighting, completion, analysis (including UML), refactorings, intentions, inspections, code generation, navigation and much more. We won't focus on these features in this tutorial (a whole book could be written on the topic), but at the first glance you'll notice a lot of warnings about unused imports, unused classes/fields/methods/parameters, methods that could be static, fields that could be converted to local vars, and so on.
Just select any run configuration in the corresponding tool bar combo box and click Run or Debug.