Debug an Adobe AIR mobile application with Visual Studio Code - BowlerHatLLC/vscode-as3mxml GitHub Wiki

  1. Create a new ActionScript project targeting Adobe AIR for mobile.

  2. In Visual Studio Code, open the Run menu and select Add Configuration….

  3. When prompted to Select Environment, choose SWF.


    If .vscode/launch.json already exists in your workspace, you will be given a list of snippets to choose from instead. Select either SWF: Launch Standalone SWF or SWF: Launch Adobe AIR mobile simulator.


  4. A new editor will open with a launch.json file that looks something like this:

    {
    	// Use IntelliSense to learn about possible SWF debug attributes.
    	// Hover to view descriptions of existing attributes.
    	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    	"version": "0.2.0",
    	"configurations": [
    		{
    			"type": "swf",
    			"request": "launch",
    			"name": "Launch SWF"
    		}
    	]
    }
  5. Specify some extra launch configuration options to simulate a mobile device in the AIR Debug Launcher:

    {
    	"type": "swf",
    	"request": "launch",
    	"name": "Launch SWF",
    	"profile": "mobileDevice",
    	"screensize": "iPhoneRetina",
    	"screenDPI": 326,
    	"versionPlatform": "IOS"
    }

    Setting the profile option to "mobileDevice" is required for all mobile projects. The other three options, screensize, screenDPI and versionPlatform, may be customized to simulate a variety of mobile devices. See launch.json configuration settings for simulating common mobile devices in Adobe AIR for some sample configuration options to use.

  6. Run the build task with Ctrl+Shift+B (or Command+Shift+B on macOS).

  7. Open Visual Studio Code's Run menu, and select Start Debugging. Alternatively, use the F5 keyboard shortcut to start debugging.

Build automatically before debugging

Instead of building manually with Ctrl+Shift+B, you can configure launch.json to build your project automatically when start debugging in Visual Studio Code. By setting the preLaunchTask field in launch.json to the name of one of your workspace's tasks, it will automatically run that task before the debugger is launched.

Warning: If you're compiling debug builds using the Quick Compile & Debug command, DO NOT use preLaunchTask. It will cause your project to build twice before starting the debugger, which won't be very "quick" at all! 😄

If you have a default build task configured, the preLaunchTask field in launch.json should contain the ${defaultBuildTask} token:

{
	"type": "swf",
	"request": "launch",
	"name": "Launch SWF",
	"preLaunchTask": "${defaultBuildTask}"
}

If you prefer, you can use the exact name of any of the built-in tasks provided by the ActionScript & MXML extension:

{
	"type": "swf",
	"request": "launch",
	"name": "Launch SWF",
	"preLaunchTask": "ActionScript: compile debug - asconfig.json"
}

You can find the complete list of tasks that are available in your workspace when you go to the Terminal menu and choose Run Task....

Further Reading

⚠️ **GitHub.com Fallback** ⚠️