Tip:
Highlight text to annotate it
X
Once you have created your first application, you can then start to integrate
some of the JavaScript libraries that are available with the Adobe AIR SDK.
The most critical JavaScript file is the AIRAliases.js file. This file defines a
number of aliases that is variables that represent complex objects in the AIR
SDK. You can find the AIRAliases file in the SDK either from the downloadable
SDK from the Adobe website or in files that are installed with the AIR
extension from Dreamweaver. I'm going to use the AIR SDK version because that
guarantees that I'm using the most recent version from Adobe. I'll go to my
AdobeAIRSDK folder that I unpacked earlier and from there, I'll go down to the
frameworks folder and you'll find there a number of JavaScript library files.
Here's the critical file, AIRAliases.js. I'll copy that file to the clipboard.
Then I'm going to paste the file into the location of my site where I'm
creating my application. I'll go to the Exercise Files directory, which I have
on my desktop. From there I'll go to the Chapter01 HelloWorld folder and from
there, to the Begin folder. Then I'll paste the file into place. I'll right
click and select Paste. Now I'll return to Dreamweaver and in Dreamweaver, I'll
click the Refresh button and show that the AIRAliases.js file is now available.
This is like any other JavaScript file. You integrated into your application by
adding a script tag with a source attribute. So now I'll look at the
application code. I'll place the cursor inside the head section of the document
and I'm going to expand the code to full-screen view so we can see as much of
it as possible. With the cursor inside the head section, I'll create a script
tag set. And then in the begin tag, I'll add an src attribute and then when
Dreamweaver pops up the Browse icon, I'll click it and I'll browse and select
the file AIRAliases.js and click OK. In addition, I'll set the language property
to a value of JavaScript. I'll save my changes and now I'll be able to refer to
any of the content of that AIRAliases file. Here's what the file does.
I'll open the file in Dreamweaver and show that it includes definitions of aliases
pointing to complex objects from the AIR API. For example, the file object
is actually a member of a package called window.runtime.flash. filesystem.file.
When you implement the AIRAliases file, it allows you to call that
file object using the syntax simply of air.file.
So in the next video, I'll show you an example using the trace function, which
allows you to debug your applications in Dreamweaver CS4.