-
-
Notifications
You must be signed in to change notification settings - Fork 45
Debug a transpiled ActionScript project in Visual Studio Code with Mozilla Firefox
-
Create a new ActionScript project targeting HTML and JavaScript (no framework) or the Apache FlexJS framework.
-
In your project's asconfig.json, specify the
source-mapcompiler option."compilerOptions": { "source-map": true, }
This will allow you to debug using the original ActionScript code.
-
Install the Debugger for Firefox extension for Visual Studio Code.
-
Create a directory named .vscode, if it doesn't already exist.
-
In the .vscode directory, create a file named launch.json.
-
To load from a web server, add the following content to launch.json:
{ "version": "0.2.0", "configurations": [ { "name": "Launch Firefox against localhost, with sourcemaps", "type": "firefox", "request": "launch", "url": "http://localhost:8080", "webRoot": "${workspaceRoot}" } ] }Customize the
urlfield to point to the correct URL for your web server. -
To load a local HTML file, add the following content to launch.json:
{ "version": "0.2.0", "configurations": [ { "name": "Launch Firefox, debug build with sourcemaps", "type": "firefox", "request": "launch", "file": "${workspaceRoot}/bin/js-debug/index.html" } ] }
-
-
Run the build task with Ctrl+Shift+B (or Command+Shift+B on macOS).
-
Open Visual Studio Code's Debug pane, and press the button with the play
▶️ icon to start debugging. Alternatively, use the F5 keyboard shortcut to start debugging.
Instead of building manually with Ctrl+Shift+B, you can configure launch.json to build your project automatically when you ask it to start debugging.
If you set the preLaunchTask field in launch.json to the same value as the identifier field of the default build task from tasks.json, it will automatically run that task before debugging.
In the following tasks.json, the default build task has a "build-debug" identifier:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"identifier": "build-debug",
"type": "actionscript",
"debug": true,
"group": {
"kind": "build",
"isDefault": true
}
}
]
}Specify that identifier as the preLaunchTask in launch.json to run that task automatically when launching in the debugger:
"preLaunchTask": "build-debug"- Adobe AIR (Mobile)
- Adobe AIR (Desktop)
- Adobe Flash Player
- Apache Royale
- HTML and JS (no framework)
- Node.js
- Feathers SDK
- Adobe Animate
- Flex SDK
- Library (SWC)
- Royale Library (SWC)