-
-
Notifications
You must be signed in to change notification settings - Fork 45
Debug a SWF in the standalone Adobe Flash Player with Visual Studio Code
Debugging SWF files in the standalone Adobe Flash Player will be supported in the upcoming version 0.4.0 of the NextGen ActionScript extension. This version is still in development, and it has not yet been released yet.
Before debugging a SWF file, you will need to download a special version of the Adobe Flash Player that supports debugging. Visit the Adobe Flash Player Debug Downloads page to download the Flash Player projector content debugger for your operating system.
-
Create a new ActionScript project targeting Adobe Flash Player.
-
In your project's
asconfig.json, be sure to add thedebugcompiler option."compilerOptions": { "debug": true, }
This will tell the compiler to create a SWF file that is compatible with the debugger.
-
In Visual Studio Code, open the command palette by pressing Ctrl+Shift+P (or Command+Shift+P on macOS).
-
Type
launchand select Debug: Open launch.json. -
When prompted to Select Environment, choose SWF.
If
.vscode/launch.jsonalready exists in your workspace, you will not be asked to specify the environment. Instead, the existing file will open. You may click the Add Configuration button to add a new SWF debugging configuration to the existing file. Several default snippets are available, depending on which Adobe Flash runtime you are targeting.
-
A new editor will open with a
launch.jsonfile 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", "program": "bin/MyProject.swf" } ] }The
programfield inlaunch.jsonshould be populated automatically, based on theoutputcompiler option or the name of the main class name specified inasconfig.json. -
Build the project by pressing 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 before debugging. If you set the "preLaunchTask" field in launch.json to the same value as the "command" field from tasks.json, it will automatically run that task before debugging.
In the following example, tasks.json runs asconfigc, so that's what we set as the "preLaunchTask":
"preLaunchTask": "asconfigc"Note: If the "command" field in tasks.json contains an absolute path to an executable, you must include the full path.
"preLaunchTask": "/path/to/asconfigc"Depending on your operating system, starting a debugging session may automatically open standalone Flash Player. If it does not — or if you prefer to test SWF content in a different version of Adobe Flash Player — you may add the runtimeExecutable field in launch.json to customize which executable is launched.
On Windows, set runtimeExecutable to the absolute path of the .exe file:
{
"type": "swf",
"request": "launch",
"name": "Launch SWF",
"program": "bin/index.html",
"runtimeExecutable": "c:\\Downloads\\flashplayer_sa_debug.exe"
}On macOS, set runtimeExecutable to the absolute path of the .app file:
"runtimeExecutable": "/Applications/Flash Player.app"On Linux, set runtimeExecutable to the absolute path of the executable file:
"runtimeExecutable": "/usr/bin/flashplayer_sa_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)