Skip to content

Build an ActionScript project in Visual Studio Code

Josh Tynjala edited this page Sep 18, 2017 · 52 revisions

The NextGen ActionScript extension for Visual Studio Code supports building SWF files for Adobe AIR and Flash Player, and it can also build Apache FlexJS applications that run in web browsers without a plugin.

To build a project in Visual Studio Code, you will need to configure your workspace's SDK and to create an asconfig.json file for one of the supported project types.

Prerequisites

Install the asconfigc utility from npm. This requires Node.js version 6 or newer.

npm install -g asconfigc

The extension will use asconfigc to read the project's asconfig.json file and run the compiler using the specified options.

Quick build

Go to the Tasks menu and select Run Build Task...

Alternatively, use the Ctrl+Shift+B keyboard shortcut (or Command+Shift+B on macOS).

A list of available tasks for ActionScript projects will appear, and you can choose between a debug or release build.

Screenshot of Visual Studio Code status bar with the FlexJS SDK selected

If you don't see these tasks, you may have forgotten to create an asconfig.json file for your project.

The extension will run the compiler from your workspace's SDK using asconfigc.

In the following section, you'll learn how to make one of these options into the default build task so that you don't need to select one every time.

Set the default build task

If a default build task is set, it runs automatically with the Ctrl+Shift+B keyboard shortcut (or Command+Shift+B on macOS).

  1. Go to the Tasks menu and select Configure Default Build Task.

  2. From the list of available tasks, choose ActionScript: debug build using asconfig.json

  3. The following document will open in your editor:

    {
    	// See https://go.microsoft.com/fwlink/?LinkId=733558
    	// for the documentation about the tasks.json format
    	"version": "2.0.0",
    	"tasks": [
    		{
    			"type": "actionscript",
    			"debug": true,
    			"group": {
    				"kind": "build",
    				"isDefault": true
    			}
    		}
    	]
    }
  4. Above the line where it says "type": "actionscript", insert the following field:

    "identifier": "build-debug",

    You can use this identifier later to tell Visual Studio Code to build the project before launching the debugger.

  5. To build your project, press Ctrl+Shift+B (or Command+Shift+B on macOS). You will no longer be prompted to choose between a debug and release build.

If you need to run a release build, go to the Tasks menu and choose Run Task.... You will be given the list of all available tasks to choose from.

Further Reading

Clone this wiki locally