Skip to content

Create a new ActionScript project in Visual Studio Code that targets Adobe AIR for desktop platforms

Josh Tynjala edited this page Nov 21, 2017 · 27 revisions

Learn to set up a project in Visual Studio Code to create an Adobe AIR application that runs on desktop operating systems, including Windows and macOS.

  1. Install the ActionScript & MXML extension for Visual Studio Code.

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

  3. Choose an ActionScript SDK for your workspace.

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

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

  6. Inside src, create a file named Main.as, and add the following code:

    package
    {
    	import flash.display.Sprite;
    	import flash.text.TextField;
    
    	public class Main extends Sprite
    	{
    		public function Main()
    		{
    			var tf:TextField = new TextField();
    			tf.text = "Hello World";
    			addChild(tf);
    		}
    	}
    }
  7. Inside src, create an AIR application descriptor file named Main-app.xml. AIR application descriptors may be configured with many more elements, but you can use the following simple content as a starting point:

    <?xml version="1.0" encoding="utf-8" ?> 
    <application xmlns="http://ns.adobe.com/air/application/24.0"> 
    	<id>com.example.Main</id> 
    	<versionNumber>0.0.0</versionNumber> 
    	<filename>Main</filename> 
    	<name>Main</name> 
    	<initialWindow>
    		<content>[Path to content will be replaced by asconfigc]</content> 
    		<visible>true</visible>
    	</initialWindow>
    </application>

    Be sure to update the version number in the namespace http://ns.adobe.com/air/application/24.0 to match the version of Adobe AIR that you are targeting.

Next Steps

Clone this wiki locally