Table of Contents

IntelliJ IDEA

This document aims to help you set up IntelliJ IDEA to use with Starling for desktop and mobile development.

If you find an error or a missing step, or if you have some other suggestion that might make things clearer for beginners, please help us out by enhancing this document! Just hit one of the Edit buttons and write away.

Preparations

  1. Make sure that Flash/Flex support is turned on in IDEA.
    • For this, navigate to Preferences → Plugins and check if “Flash/Flex Support” is activated.
  2. Download the latest AIR SDK from here.
    • Once downloaded, extract the archive and save it to a location you remember.
  3. Let IDEA know about Flex/AIR SDK
    • Navigate to File → Project Structure → SDKs. Then click on the “+” button, choose Flex/AIR SDK and navigate to the AIR SDK on your disk.
    • (Optional) Switch to the Documentation Paths tab in the same dialog window, click on the “+” button with a globe, and add the following URL:
      http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/
  4. Specify Starling as a Global Library
    • In the same window (File→Project Structure), click on Global Libraries in the list on the left. Then click on the “+” button.
    • Choose Actionscript/Flex, then specify this folder: [path-to-starling]/starling/src. Make sure it's added as Raw ActionScript library, not as Library sources.
    • In my case, the library was now simply named “src”, which is confusing. Rename it to “Starling” via the “Name:” text field.

Creating a Project that uses Starling

Creating the application descriptor

This step can be skipped if you are working on a project that targets the Flash Plugin.

All AIR projects need a special application descriptor XML file to run. IDEA will create one automatically, but to be able to run your app using direct rendering, you'll need to alter a few things, so it's good to have such a file added to your project and not being recreated every time you hit build.

Running the app

Running on 'iOS Simulator'

The build configuration also supports running the app in the official iOS Simulator from Apple (on macOS only). However, it doesn't provide a way to choose the actual device being simulated (iPhone x, iPad?).

To do this, you need to set the environment variable AIR_IOS_SIMULATOR_DEVICE via the terminal to the corresponding value, for example:

launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 4s"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 5"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 5s"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 6"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 6 Plus"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 7"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPhone 7 Plus"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPad 2"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPad Retina"
launchctl setenv AIR_IOS_SIMULATOR_DEVICE "iPad Air"

For reference: the String you have to use it the exact text you see in the “Hardware / Device” menu of the iPhone simulator. Beware:

This forum post contains several great tips about how best to set up your IntelliJ modules for multi-platform development: My Thoughts after Completing my first Starling App.