Skip to content

Create a new ActionScript project in Visual Studio Code that targets the classic Apache Flex SDK

Josh Tynjala edited this page Mar 15, 2017 · 32 revisions

For Apache FlexJS, see Create a project that targets the FlexJS framework instead. The instructions below explain how to create a project for the classic Apache Flex SDK that runs on the Adobe Flash runtimes only.


  1. Install the NextGen ActionScript extension for Visual Studio Code.

  2. Install the Apache Flex SDK.

  3. Create a new directory for your project, and open it in Visual Studio Code.

    To open a directory, select the File menu → Open... or click Open Folder button in the Explorer pane.

  4. Open the File menu (On macOS, open the Code application menu) and go to PreferencesWorkspace Settings, and add the following setting to the file:

    nextgenas.sdk.framework: "path/to/flex/sdk"
    

    Change the path to point to the location where you installed the Apache Flex SDK.

    Note: Don't pass the classic Flex SDK to the nextgenas.sdk.editor setting. nextgenas.sdk.editor must continue to point to an Apache FlexJS SDK.

  5. Create a file named asconfig.json at the root of your project, and add the following content:

    {
    	"config": "flex",
    	"compilerOptions": {
    		"debug": true,
    		"output": "bin/Main.swf"
    	},
    	"files":
    	[
    		"src/Main.mxml"
    	]
    }

    An Adobe AIR project that targets desktop should set config to "air" instead, and a mobile project should set config to "airmobile". Additionally, you should specify the path to your AIR application descriptor. Here's an example for an AIR desktop project:

    {
    	"config": "air",
    	"compilerOptions": {
    		"debug": true,
    		"output": "bin/Main.swf"
    	},
    	"application": "src/Main-app.xml",
    	"files":
    	[
    		"src/Main.mxml"
    	]
    }
  6. Create directory named src.

  7. Inside src, create a file named Main.mxml, and add the following code:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx">
    
    	<s:layout>
    		<s:BasicLayout/>
    	</s:layout>
    
    	<s:Label text="Hello World" horizontalCenter="0" verticalCenter="0"/>
    
    </s:Application>

    Note: An Adobe AIR project that targets desktop should used WindowedApplication instead of Application.

Next Steps

Clone this wiki locally