Debug an Adobe AIR application running on a mobile device 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 SWF: Launch Standalone SWF.


  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. To debug on a mobile device, we'll need to add a couple of new launch configurations to this file.

    {
    	"type": "swf",
    	"request": "attach",
    	"name": "Install and Attach (iOS)",
    	"platform": "ios"
    }
    {
    	"type": "swf",
    	"request": "attach",
    	"name": "Install and Attach (Android)",
    	"platform": "android"
    }
  6. Package the Adobe AIR application. It must be a debug build for either iOS or Android.

  7. Ensure that one of the new Install and Attach configurations is selected in the Debug view.

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

  9. When your app is finished installing, it will launch automatically on Android. On iOS, you will need to manually launch your application before the debugger will connect.

USB Debugging

By default, attaching the debugger to an Adobe AIR application that is running on a mobile device will attempt to connect over wifi. To debug over USB instead, you must modify a couple of fields in your configuration files.

In asconfig.json, set the listen field in the ios or android section to true:

{
	"airOptions": {
		"ios": {
			"listen": true
		},
		"android": {
			"listen": true
		}
	}
}

In launch.json, set the connect field to true:

{
	"type": "swf",
	"request": "attach",
	"name": "Attach SWF",
	"connect": true,
	"platform": "android"
}

Be sure to set the platform field in launch.json to either "ios" or "android", depending on which type of device you have connected over USB. This will automatically install the application on your mobile devices when the debugger starts.

Build automatically before debugging

Instead of packaging your Adobe AIR app manually before debugging, you can configure launch.json to run a task automatically when you start the debugger.

If you set the preLaunchTask field in launch.json to the name of one of the built-in tasks provided by the ActionScript & MXML extension, it will automatically run that task before debugging.

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....

For simple projects, the preLaunchTask field in launch.json should be set to either Adobe AIR: package iOS debug - asconfig.json or Adobe AIR: package Android debug - asconfig.json:

{
	"type": "swf",
	"request": "launch",
	"name": "Launch SWF",
	"preLaunchTask": "Adobe AIR: package iOS debug - asconfig.json"
}

If your workspace contains multiple root folders, you may need include the name of the root folder before asconfig.json in the task name:

{
	"type": "swf",
	"request": "launch",
	"name": "Launch SWF",
	"preLaunchTask": "Adobe AIR: package iOS debug - MyProject/asconfig.json"
}

Further Reading

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