Skip to content

Debugging Flash and AIR

m0rkeulv edited this page Oct 20, 2026 · 2 revisions

Debug Haxe applications compiled to Flash (.swf) or Adobe AIR. A SWF runs in the standalone Flash Player; a desktop AIR application runs in adl, the AIR Debug Launcher of the AIR SDK. The debugging itself is done by the JetBrains Flash/Flex plugin, with the Flash debugger (fdb) of your Flex/AIR SDK.

Note

IntelliJ IDEA Ultimate. Debugging needs the Flash/Flex plugin, which JetBrains Marketplace offers for IntelliJ IDEA Ultimate only. Running a SWF in the standalone player without the debugger works without it.

This page covers what is special about Flash and AIR. For the workflow all debuggers share, see Debugging Overview.

What you need

What Needed for Where to get it
The Flash/Flex plugin from JetBrains Debugging SWFs and AIR applications Settings | Plugins, Marketplace tab
A Flex/AIR SDK, registered in the IDE Debugging SWFs and AIR applications. Running an AIR application needs only the SDK's adl, which may also come from the AIR_SDK environment variable. The AIR SDK from HARMAN: download, installation guide. The Flash/Flex plugin also accepts a Flex SDK.
A standalone Flash Player, a debugger version for debugging Running and debugging a SWF with Haxe Flash Application See below

To debug a SWF, the standalone player must be a debugger version (the "projector content debugger"); the Haxe manual recommends the standalone debugger player for the Flash target (Getting started with Haxe/Flash). Adobe ended support for Flash Player at the end of 2020 and removed its download pages (Adobe), so you need a player you already have. AIR applications do not need it: adl comes with the AIR SDK.

Set up the Flex/AIR SDK

  1. Install the Flash/Flex plugin: open Settings | Plugins, search the Marketplace tab for Flash/Flex, install it and restart the IDE.
  2. Download and unpack the AIR SDK, as described in the AIR SDK installation guide.
  3. Open File | Project Structure | Platform Settings | SDKs, click +, choose the Flex/AIR SDK entry and select the SDK's folder.
  4. Tell the plugin which SDK to use:
    • for one project, in Flex/AIR SDK: in the Runtime Overrides group of Settings | Build, Execution, Deployment | Build Tools | Haxe;
    • for every project that uses a Haxe SDK, in Flex/AIR SDK: under Runtimes on that Haxe SDK's page in Project Structure | Platform Settings | SDKs.

A run configuration can choose a different SDK; when it does not, the project setting wins over the Haxe SDK's.

The Flex/AIR SDK: lists stay disabled until a Flex/AIR SDK is registered. The browse button next to each of these lists opens the IDE's SDK list, so you can also add the SDK from there.

For the Lime and OpenFL air target, the plugin also hands this SDK to the Lime tool as AIR_SDK; see Building and Running.

Debug a SWF

The Haxe Flash Application run configuration opens a SWF in the standalone Flash Player.

Create the configuration

  • From the Haxe tool window. Right-click the Build & run entry of a build file that compiles to a SWF (for example -swf bin/main.swf, or the Lime or NME flash target) and choose Debug. The first time, this creates a configuration named after the build file, such as build.hxml (Flash). It builds the file before every launch and points to the compiled SWF. The Flash player and the Flex/AIR SDK cannot be guessed; set them in the configuration or in the settings above.
  • By hand. Open Run | Edit Configurations…, click +, choose Haxe and then Haxe Flash Application. To have it build your project first, add a Run Haxe action step under Before launch.

Fields that matter for debugging

Field Meaning
Swf file: The SWF to debug. A relative path is resolved against the module's folder.
Flex SDK (debug): The Flex/AIR SDK whose debugger runs the session. The first entry, Use the Haxe SDK's Flex/AIR SDK, takes the one from Build Tools | Haxe or the Haxe SDK.
Flash player (run): The standalone Flash Player executable. A debug session opens the SWF with it, too. When it is empty, the Flash player executable: from Build Tools | Haxe or the Haxe SDK is used; when none is set anywhere, the debugger opens the SWF with the program your system associates with .swf files.

See Run Configurations for the remaining fields.

Start debugging

  1. Launch the configuration with Debug. Its build step compiles the SWF with -debug -D fdb; see Debug builds are made for you.
  2. The debugger starts and opens the SWF in the player.
  3. The player connects to the debugger, and your breakpoints become active. Until it connects, the debugger shows Waiting for AIR or Flash player to connect.

Haxe marks a SWF as debuggable for the Flash debugger only when fdb is defined (Haxe manual), which is why the build step adds it. If the debugger keeps waiting, check that the player is a debugger version. A configuration that builds without a Run Haxe action step needs -D fdb in your build file.

Debug an AIR application

The Haxe AIR Application run configuration starts a desktop AIR application with adl.

Create the configuration

  • Lime and OpenFL air target. Use Build & run in the Haxe tool window, as for a SWF. The configuration is named like project.xml (AIR) and points to the descriptor application.xml and the content root in the folder the project's <config:air output-directory> names, or in the air folder of the export directory by default.
  • Other build files. Build & run of a plain -swf build creates a Haxe Flash Application. To run the SWF as an AIR application instead, write an application descriptor and create a Haxe AIR Application by hand: Run | Edit Configurations…, +, Haxe, Haxe AIR Application.

Fields that matter for debugging

Field Meaning
Application descriptor: The application's descriptor XML, such as application.xml.
Content root: The folder the descriptor's <content> path is resolved against. Empty means the descriptor's folder.
Flex/AIR SDK: The SDK that provides adl and the debugger. The first entry, Use the Haxe SDK's Flex/AIR SDK, takes the one from Build Tools | Haxe or the Haxe SDK.
ADL options: Extra options for adl, placed before the descriptor.
Program arguments: Arguments for your application, passed after --.

See Run Configurations for all fields.

Run and debug

  • Run starts adl with the -nodebug option. This does not use the Flash/Flex plugin: adl comes from the configuration's Flex/AIR SDK, from Build Tools | Haxe or from the AIR_SDK environment variable.
  • Debug starts the debugger first and then adl without -nodebug, so that the application connects to the waiting debugger. The configuration's build step compiles with -debug. The output of adl and its exit code appear in the console of the Debug tool window. When you close the application, the session ends; when you stop the session, the application closes.

One instance per application id

AIR runs one instance per application id: a second launch with the same id hands over to the running instance and exits at once. So if an instance started outside the IDE is still running, a new launch ends right away. In a debug session, the console then shows A previous instance of this AIR app is still running outside the IDE - stop it (or enable Allow multiple instances) and relaunch.

To run several instances side by side, turn on Allow multiple instances for the configuration. Each launch then uses a copy of the descriptor whose <id> gets a unique suffix, so every instance also gets its own application storage. The descriptor needs an <id> element for this.

trace() output

On Flash and AIR, Haxe's trace() writes into a text field inside your application's window, not to the console. To get it in the console, compile with -D native_trace (or -D fdb): trace() then uses the runtime's own trace output. That output appears in the console of a debug session, and of an AIR application started with Run.

Breakpoints

Set breakpoints in the .hx files of the build you debug. A breakpoint in a file outside that build's class paths is shown as invalid for the session. This keeps a breakpoint in another build's Main.hx from stopping in yours. A configuration without a Run Haxe action step uses the module's files instead of the build's class paths.

Good to know

  • A SWF built a second time through the compilation server can fail at start with VerifyError #1053, a bug in the Haxe compiler. Restart the server, or build without it, for a clean SWF; see A rebuilt SWF fails at load.
  • Flash and AIR unit tests run under adl and can be debugged the same way; see Unit Tests.
  • Profiling works for AIR applications only, with IntelliJ IDEA Ultimate; see Profiling Flash and AIR.
  • The configurations cover a SWF in the standalone player and desktop AIR applications. There are no options for a SWF inside a web page or for AIR on mobile devices.

If something goes wrong

Message What to do
Please install Flex plugin to debug Flash target! Install the Flash/Flex plugin.
Please enable Flex plugin to debug Flash target! Enable the Flash/Flex plugin in Settings | Plugins.
No Flex/AIR SDK - select one here or under the Haxe SDK's runtimes Register a Flex/AIR SDK and select it, as described above.
No Flash player executable configured - set one here or under the Haxe SDK's runtimes Set Flash player (run):, or the Flash player executable: in the settings.
adl not found in Flex/AIR SDK '...' - expected at ... The selected SDK has no bin/adl. Select an AIR SDK, or a Flex SDK that contains AIR.
Application descriptor not found: ... Build the project, or correct Application descriptor:.
A debug session ends at once with adl exited with code ... Read the adl output above it in the console. If it mentions a running instance, see One instance per application id.

Clone this wiki locally