-
-
Notifications
You must be signed in to change notification settings - Fork 41
Create a new ActionScript project in Visual Studio Code that targets Adobe AIR for desktop platforms
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.
-
Install the ActionScript & MXML extension for Visual Studio Code.
-
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.
-
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" ] }
-
Create directory named src.
-
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); } } }
-
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.
See How to build an ActionScript project in Visual Studio Code to learn how to run a task to compile the SWF file for your AIR application.
See How to debug an Adobe AIR desktop application for complete details about debugging.
To export a release build of our AIR application that may be installed by users, we first need to configure the AIR Developer Tool (adt) options. We're going to add a new airOptions
section in asconfig.json:
{
"config": "air",
"compilerOptions": {
"output": "bin/Main.swf"
},
"application": "src/Main-app.xml",
"files": [
"src/Main.as"
],
"airOptions": {
}
}
First, we need to specify the output path for the .air file:
"airOptions": {
"output": "bin/Main.air"
}
Next, we need to specify the signing options, such as the type of certificate and its path on the filesystem:
"airOptions": {
"output": "bin/Main.air",
"signingOptions": {
"storetype": "pkcs12",
"keystore": "path/to/certificate.p12"
}
}
Note: We don't specify the certificate password in asconfig.json. We'll be asked for the password later!
Finally, we may have some files (and folders) to include, including icons and other assets:
"airOptions": {
"output": "bin/Main.air",
"signingOptions": {
"storetype": "pkcs12",
"keystore": "path/to/certificate.p12"
},
"files": [
{
"file": "icons/icon48.png",
"path": "icon48.png"
},
{
"file": "icons/icon128.png",
"path": "icon128.png"
}
]
}
The file
property refers to the location of a file (or folder) on your computer's local filesystem. The path
property is the location where it will be added to the application package.
See How to package an Adobe AIR application in Visual Studio Code to learn how run a task to package your application using these new options.
- Adobe AIR (Mobile)
- Adobe AIR (Desktop)
- Adobe Flash Player
- Apache Royale
- HTML and JS (no framework)
- Node.js
- Feathers SDK
- Adobe Animate
- Classic Flex SDK
- Library (SWC)
- Royale Library (SWC)