Skip to content

Create a new ActionScript project in Visual Studio Code that targets JavaScript and HTML

Josh Tynjala edited this page Nov 22, 2016 · 20 revisions
  1. Install the NextGen ActionScript 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. Create a file named asconfig.json at the root of your project, and add the following content:

    {
    	"config": "js",
    	"compilerOptions": {
    		"debug": true
    	},
    	"files":
    	[
    		"src/Main.as"
    	]
    }
  4. Create directory named src.

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

    package
    {
    	public class Main
    	{
    		public function Main()
    		{
    			var element:HTMLParagraphElement = document.createElement( "p" ) as HTMLParagraphElement;
    			element.textContent = "Hello World";
    			document.body.appendChild( element );
    		}
    	}
    }
  6. Inside the project's root directory, create a file named debug.html, and add the following code:

    <!doctype html>
    <html>
    <head>
    	<meta charset="utf-8"/>
    	<title>Debug</title>
    	<script src="bin/js-debug/library/closure/goog/base.js"></script>
    	<script src="bin/js-debug/Main-dependencies.js"></script>
    </head>
    <body>
    <script>
    	new Main();
    </script>
    </body>
    </html>

Next Steps

Clone this wiki locally