Preface

This book provides a quick introduction to developing applications for Adobe AIR. Adobe AIR is a new cross-platform desktop application runtime created by Adobe. Although Adobe AIR allows both Flash- and HTML-based application development, this book focuses on building applications using HTML and JavaScript.

The book gives an overview of Adobe AIR, shows how to set up your development environment, and discusses new Adobe AIR functionality and APIs. Once you have finished reading this book, you should have a good understanding of what Adobe AIR is as well as how to build HTML and JavaScript applications for it.

Adobe AIR Runtime Naming Conventions

Adobe AIR allows developers to leverage a number of web technologies to deploy web applications to the desktop. Indeed, there are so many technologies that it can be difficult to keep track of them all. Table 1 lists the terms used in the book, and defines each one.

Table 1. AIR runtime naming conventions

Name

Meaning

Adobe AIR

The cross-platform desktop runtime that enables the running of Adobe AIR applications.

Adobe AIR application

An application built with Flash, HTML, and/or PDF that runs on top of Adobe AIR.

Adobe Flash

Any content contained within a SWF 9 file format that runs in the Adobe Flash Player or Adobe AIR.

ActionScript

The ECMAScript-based programming language used to program Flash content. Unless otherwise noted, all references to ActionScript in this book refer to ActionScript 3.

HTML

Standard web-based markup language used to create and lay out web pages.

JavaScript

Web-based implementation of ECMAScript used to program content within HTML applications.

PDF

Short for Portable Document Format, a technology that allows for seamless distribution and display of electronic documents.

Adobe Flex Framework

An XML- and ActionScript-based framework designed to make developing Flash-based Rich Internet Applications (RIAs) easy.

Adobe Flex Builder

An Eclipse-based IDE used to build Flash-based RIAs using Flex and ActionScript.

What This Book Covers

This book gives a general overview of Adobe AIR, shows how to set up your development environment to start building applications, provides an overview of the HTML and JavaScript engines within the runtime, and shows how to perform a number of common programming tasks within Adobe AIR.

The following is a partial list of features and functionality included in the Adobe AIR 1.0 release:

  • Mac support (OS X 10.4.9 and later; Intel and PPC)

  • Windows support (Windows Vista, Windows XP SP2, and Windows 2000 SP4)

  • File I/O API

  • SQLite embedded database

  • All functionality within Flash Player 9, including complete network stack

  • Windowing APIs

  • Command-line tools (ADL and ADT)

  • HTML support within Flash-based content

  • Top-level HTML applications

  • Flash content within HTML applications

  • ActionScript/JavaScript script bridging

  • Flex Builder and Flex Framework support for authoring Adobe AIR applications

  • Application command-line arguments

  • Drag-and-drop support

  • Rich clipboard access

  • Native menu API

  • Full-screen support

  • Application update API

  • Online/offline detection API

  • Encrypted local data stores

  • Presence APIs

  • File type associations

  • Application icons

  • PDF support

  • Right-click and contextual menu control

  • System notifications

We will cover these features in more detail throughout the rest of the book.

Errors and Errata

This book is written against the 1.0 release of Adobe AIR, and was finalized after the runtime was released. Thus, all information in the book should be correct for Adobe AIR 1.0. However, it is possible that there will be updates to the runtime, or that there are errors within the book. If something in the book does not seem correct, check the online documentation for the latest information.

You can find the latest information and documentation on Adobe AIR at:

http://www.adobe.com/go/air

You should also check the book’s errata web site for the latest updates and corrections:

http://www.adobe.com/go/airjavascriptpocketguide

Audience for This Book

We hope this book is for you, but just to be sure, let’s discuss some of the assumptions that we made, as well as what types of developers the book targets.

Who This Book Is For

This book is for developers interested in leveraging HTML and JavaScript to build and deploy applications to the desktop via Adobe AIR. If you don’t have any experience with developing with HTML and JavaScript, we suggest that you spend some time getting up to speed on these technologies.

What Does This Book Assume?

The book assumes that the reader has at least a basic familiarity with creating HTML-based web applications and content using HTML and JavaScript.

You should be familiar with web technologies such as HTML, JavaScript, Ajax, and CSS, as well as general web development concepts.

Who This Book Is Not For

Although it is possible to create Flash- and Flex-based applications with Adobe AIR, this book does not go into any detail on Flash- and Flex-focused AIR application development. If you are a Flash or Flex developer interested in building AIR applications, this book can provide a good introduction and overview of AIR and its functionality, but you should view the Adobe AIR documentation and articles available from the Adobe AIR web site for a more Flash/Flex-focused discussion.

How This Book Is Organized

This book contains the following chapters, as well as one appendix:

Chapter 1, Introduction to Adobe AIR

Provides a general overview of what Adobe AIR is and the types of applications it targets

Chapter 2, Getting Started with Adobe AIR Development

Covers tips on starting your Adobe AIR development, and the steps for creating your first Adobe AIR application from the command line

Chapter 3, Working with JavaScript and HTML Within Adobe AIR

Gives an overview of the HTML and JavaScript runtime environments within Adobe AIR, and provides an introduction to using JavaScript to access Adobe AIR functionality and APIs

Chapter 4, Adobe AIR Mini-Cookbook

Provides tips and tricks for accomplishing common tasks within Adobe AIR applications, presented in the O’Reilly Cookbook format

Appendix A

Lists JavaScript aliases to Adobe AIR APIs

How to Use This Book

You can use this book as an introduction to and overview of Adobe AIR, and as a step-by-step guide to getting started with Adobe AIR application development. Although it may be tempting to jump ahead to specific sections, it is strongly suggested that you at least read the first two chapters, which provide an overview of the runtime and discuss how to set up your development environment for building Adobe AIR applications. This will make it much easier to then jump into the specific areas of runtime functionality that may interest you.

Once you have read the book and understand the basics of how to build an Adobe AIR application with HTML and JavaScript, then you can use the book as a reference, referring to specific sections when you need to know how to tackle a specific problem. In particular, the Cookbook sections should prove useful as you develop your applications.

Finally, this book is just an introduction to Adobe AIR and does not cover all of the features and functionality included within it. It is meant to complement, but not replace, the extensive and in-depth documentation on the runtime provided by Adobe. Make sure to explore the documentation to ensure that you’re familiar with all of the APIs and functionality not covered in this book.

Conventions Used in This Book

The following typographical conventions are used in this book:

Plain text

Indicates menu titles, menu options, menu buttons, and keyboard accelerators (such as Alt and Ctrl).

Italic

Indicates new terms, URLs, email addresses, filenames, file extensions, pathnames, directories, and Unix utilities

Constant width

Indicates commands, options, switches, variables, attributes, keys, functions, types, classes, namespaces, methods, modules, properties, parameters, values, objects, events, event handlers, XML tags, HTML tags, macros, the contents of files, and the output from commands

Constant width bold

Shows commands or other text that should be typed literally by the user

Constant width italic

Shows text that should be replaced with user-supplied values

License and Code Examples

This work, including all text and code samples, is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/; or send a letter to Creative Commons, 543 Howard St., 5th Floor, San Francisco, California, 94105, USA.

You can find more information on Creative Commons at http://www.creativecommons.org.

Support and More Information

Accessing the Book Online

You can always find the latest information about this book, as well as download a free electronic version of it, from the book’s web site at:

http://www.adobe.com/go/airjavascriptpocketguide

Online Adobe AIR Resources

Although Adobe AIR is a new technology, there are already a number of resources where you can find more information on Adobe AIR and RIA development.

Official AIR site

This is the primary web site for information, downloads, and documentation on AIR:

http://www.adobe.com/go/air
Adobe AIR Developer FAQ

This is the official Adobe AIR FAQ, answering common questions about AIR development:

http://www.adobe.com/go/airfaq
Adobe AIR Developer Center

This Developer Center provides articles, information, and resources on developing applications for Adobe AIR:

http://www.adobe.com/go/airdevcenter
Developing Adobe AIR applications with JavaScript

Here’s where you’ll find the Adobe AIR JavaScript documentation and API reference:

http://www.adobe.com/go/learn_air_html_jslr
Adobe AIR documentation

Visit this web site for complete Adobe AIR documentation:

http://www.adobe.com/go/airdocs
Adobe AIR Developer Center for HTML and Ajax

This Developer Center provides articles, tutorials, and whitepapers on using HTML and JavaScript to develop applications for Adobe AIR:

http://www.adobe.com/go/airajaxdevcenter
Adobe AIR Forum

This is the official Adobe forum for discussing the development of applications for Adobe AIR:

http://www.adobe.com/go/airforums
Adobe AIR coders mailing list

This is a mailing list for discussing Adobe AIR application development:

http://www.adobe.com/go/airlist
Mike Chambers’ weblog

One of the authors of this book, Mike Chambers is a member of the Adobe AIR team who posts frequently on Adobe AIR:

http://www.adobe.com/go/mikechambers
MXNA Adobe AIR Smart Category

The Adobe AIR Smart Category lists any discussions about Adobe AIR within the Adobe online development community:

http://www.adobe.com/go/airmxna
Ajaxian.com

This is an Ajax news site with information, tips, tricks, and the latest news on developing with JavaScript and Ajax techniques:

http://www.ajaxian.com
Adobe Flex Developer Center

This Developer Center provides articles, information, and resources on working with the Flex Framework:

http://www.adobe.com/go/flexdevcenter
Flex coders mailing list

This is a popular mailing list for discussing development using the Flex Framework:

http://tech.groups.yahoo.com/group/flexcoders/
Universal Desktop Weblog

This is Ryan Stewart’s weblog, which focuses on the latest developments in the world of RIAs:

http://blogs.zdnet.com/Stewart/

About the Authors

Mike Chambers

Mike Chambers has spent the past eight years building applications that target the Flash runtime. During that time, he has worked with numerous technologies, including Flash, Generator, .NET, Central, Flex, and Ajax. He is currently the principal product manager for developer relations for the Flash platform. He has written and spoken extensively on Flash and RIA development and is coauthor of Adobe Apollo for Flex Developers Pocket Guide, Flash Enabled: Flash Design and Development for Devices, and Generator and Flash Demystified.

Mike received his master’s degree in international economics and European studies from the John Hopkins School of Advanced International Studies (SAIS) in 1998.

When he is not programming, Mike can be found playing Halo, trying to recover from his World of Warcraft addiction, working on scale models, or hanging out with his two daughters, Isabel and Aubrey, and his wife Cathy.

Mike maintains a weblog at http://www.mikechambers.com/.

Daniel Dura

Currently based in San Francisco, Daniel Dura is a Platform Evangelist at Adobe, focusing on Adobe AIR and Flash. Before joining Macromedia (which merged with Adobe in 2005), Daniel and his brother Josh founded Dura Media LLC, a RIA development company based in Dallas. While at Adobe, he was a member of the Central and Flex teams, as well as a product manager for developer relations.

Daniel has given presentations on Flash, Apollo, and Flex all over the world at user group meetings, conferences, and pretty much anywhere someone has been willing to listen. Outside of his day job, he enjoys general aviation and is well on his way to earning his Private Pilot license.

Dragos Georgita

Based in Bucharest, Romania, Dragos Georgita is part of the Adobe AIR engineering staff, leading a group that focuses on JavaScript and Ajax support in the runtime. After graduating from the University Politehnica of Bucharest, he worked for a couple of companies and became interested in web technologies. Dragos has worked with both client and server technologies on different platforms and was part of the team that combined the best of the two words in the form of a search-engine-friendly Ajax framework.

Dragos also spent time trying to make the lives of web developers easier by working on automation tools for IDEs such as Adobe Dreamweaver. That period was important in developing his customer-oriented focus and attention to detail.

While part of the Adobe AIR team, Dragos is thrilled to be able to leverage his knowledge into the new breed of RIAs and to look for ways to improve the workflows for Ajax developers developing for Adobe AIR.

Outside of his day job, he enjoys spending time with his family and his 1-year-old daughter, Clara.

Kevin Hoyt

Kevin Hoyt is a Platform Evangelist with Adobe, who likes moving, breaking, blurring, and jumping over the lines of conventional technology. He seeks out every opportunity to congregate with other like-minded developers, and explores ways to escape any lines that form a box. Pushing the envelope of what technology can do, and how people perceive and interact with it, is his passion.

A frequent traveler, Kevin can generally be found deep in code while speaking with customers at conferences, in front of user groups, or anywhere else they will give him time in front of an audience. The rest of the time he enjoys spending with his family at home in Parker, Colorado, and indulging his photography habit.

This current chapter in Kevin’s career started when he accepted a job with Allaire Corporation, circa 2000, with focus on ColdFusion and JRun. Allaire was purchased by Macromedia in 2001, at which point he was able to unleash the latent designer within and help to promote the value of RIAs. Adobe acquired Macromedia in 2005, and Kevin now finds himself helping the company and its customers make sense of Adobe’s increasingly large stable of products.

Acknowledgments

The authors would like to thank Mark Nichoson and Alisa Popolizio from Adobe and Steve Weiss and Michele Filshie from O’Reilly for helping to make this book possible in an incredibly short amount of time, and Editor Audrey Doyle. We would also like to thank Adrian Ludwig, Laurel Reitman, Oliver Goldman, Chris Brichford, Lucas Adamski, Rob Dixon, and Jeff Swartz, all from Adobe, for their input and work on the book.

Also, the authors would like to thank everyone on the Adobe AIR team for all of their dedication and hard work in getting a 1.0 runtime out the door.

Get Adobe AIR for JavaScript Developers Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.