Debug a SWF in the standalone Adobe Flash Player with Visual Studio Code - BowlerHatLLC/vscode-as3mxml GitHub Wiki

🚨 Attention: Adobe has discontinued development of Flash Player. For more details, see Adobe Flash Player End Of Life. The document below is kept for educational purposes.

Prerequisites

Before debugging a SWF file, you will need to download a special version of the Adobe Flash Player that supports debugging. Use the following URLs to download the Flash Player projector content debugger for your operating system.

Note: As of March 2024, these URLs were still active, but it is best to assume that they could be removed by Adobe at any time, without notice. If you anticipate needing a standalone Adobe Flash Player executable in the future, you should download and keep a backup copy somewhere safe. If these URLs are removed, you may need to find a way to run your SWF using Adobe AIR from HARMAN instead.

Instructions

  1. Create a new ActionScript project targeting Adobe Flash Player.

  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.


  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. Run the build task with Ctrl+Shift+B (or Command+Shift+B on macOS).

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

Launch in a specific version of standalone Adobe Flash Player

If possible, the standalone Adobe Flash Player will open automatically when you debug a SWF program. On Windows and macOS, the debugger will look for an application that is associated with the .swf file extension. On Linux, the debugger will attempt to find a flashplayer or flashplayerdebugger executable by searching the directories registered with the $PATH environment variable.

If the standalone Adobe Flash Player cannot be opened automatically — or if you prefer to test SWF content in a specific version of Adobe Flash Player — you may add the runtimeExecutable field in launch.json to customize which application is launched.

On Windows, set runtimeExecutable to the absolute path of the .exe file:

{
	"type": "swf",
	"request": "launch",
	"name": "Launch SWF",
	"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": "/home/Downloads/flashplayerdebugger"

Further Reading

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