<script src="somefile.swf" type="application/x-shockwave-flash"></script>
Note that you should explicitly use the type attribute with a value of application/x-shockwave-flash.
To use ActionScript libraries:
Begin a new AIR project in your text editor or IDE.
The exact steps for doing so are outlined in Chapter 2 and Chapter 3.
Add a new folder named as to your project's directory (Figure 4.6).
Figure 4.6 The new folder—as—will store the ActionScript library.
As in the steps for using frameworks, I recommend creating a separate folder in which your ActionScript files will be stored.
Copy the servicemonitor.swf file to the folder created in step 2.
You'll find servicemonitor.swf in the frameworks folder within the SDK folder (created when you installed the SDK following the instructions in Chapter 2).
- Add the following to the head of the main HTML document:
<script src="as/servicemonitor.swf" type="application/x-shockwave-flash"></script>
If you used a different name for the ActionScript folder (created in step 2), you'll need to change this code accordingly.
Use the ActionScript code as needed in your program.
You'll see examples of this in Chapter 13, "Networking."
When you build the final application, be sure to include the as folder and the .swf file.
If you're building the application using the command-line tools (as demonstrated in Chapter 2), the requisite instruction would be something like (Figure 4.7)
adt -package -storetype pkcs12 -keystore C:\Documents and Settings\Larry Ullman\My Documents/MyCert.pfx ActionScript.air application.xml index.html AIRAliases.js as
Figure 4.7 Building the application on Windows using the command-line adt.
Aptana Studio automatically includes the file as long as it's listed in the project (see Figure 4.5 for an earlier example). With Dreamweaver, make sure you add all the files and folders in the AIR Application and Installer Settings window (see Figure 4.3 for an earlier example).