Adobe AIR Programming Unleashed

Book description

Covers version 1.5 of Adobe AIR

Written to help you hit the ground running, this book teaches you how to build state-of-the-art rich desktop applications on the breakthrough Adobe AIR platform.

Stacy Tyler Young, Michael Givens, and Dimitrios Gianninas illustrate the power of this technology through practical application examples based on the official 1.5 release of Adobe AIR. You’ll discover how Adobe AIR helps you solve problems you just couldn’t solve before by extending the reach of your web applications onto users’ desktops. Building on your existing knowledge of Adobe Flex, HTML, JavaScript, and Ajax software, you’ll master the powerful Adobe AIR platform--moving quickly from task-oriented examples to larger-scale, real-world projects. The authors don’t just cover coding--they help you maximize your effectiveness throughout the entire development lifecycle via design patterns, frameworks, build process, continuous integration, and automated testing.

If you’re ready to build the next generation of rich hybrid desktop applications, Adobe AIR is the development platform you’ve been searching for...and this is the book you need to kick-start new projects using this exciting new technology.

Detailed information on how to...

  • Install and configure your Adobe AIR development environment

  • Build the next generation web/desktop hybrid applications to run on Adobe AIR

  • Add new desktop capabilities to your web applications such as native windows, local file I/O, and client-side databases

  • Create HTML/Adobe Flex mash-up applications

  • Push data to Adobe AIR clients using BlazeDS, an open source Java remoting and messaging technology

  • Package, distribute, and update Adobe AIR applications

  • Work with display objects in 3D space by leveraging Adobe Flash Player 10

  • Build Adobe AIR applications using common frameworks like Cairngorm

  • Create automated builds using Apache Ant, complete with FlexUnit testing strategies

  • Create a peer-to-peer photo-sharing application by combining Adobe AIR and Java

  • Part I       Getting Started with Adobe AIR

    1         Introduction to Adobe AIR 9

    2         Setting Up the Development Environment 15

    3         Creating an Adobe AIR Application 29

    4         Debugging Adobe AIR Applications 51

    Part II       Building Adobe AIR Applications

    5         Working with Windows 67

    6         Working with Screens 89

    7         Working with Files and Directories 101

    8         Understanding the Drag-and-Drop API 115

    9         Working with Copy and Paste 129

    10       Working with Native Menus 159

    11       Adding User Notifications 177

    12       Working with Local Databases 189

    13       Understanding Networking and Local Connections 213

    14       Working with Adobe Flex AIR Components 251

    Part III       Securing Adobe AIR Applications

    15       Understanding Security Sandboxes 263

    16       Using the Encrypted Local Store 273

    Part IV       Deploying Adobe AIR Applications

    17       Distributing Adobe AIR Applications 283

    18       Updating Adobe AIR Applications 309

    Part V       Architecting Adobe AIR Applications

    19       Introduction to Frameworks and Design Patterns 321

    20       Building Adobe AIR Applications Using the Cairngorm Microarchitecture 335

    Part VI       Agile Development with Adobe AIR

    21       Creating a Build Process 359

    22       Incorporating Unit Testing 373

    23       Continuous Integration with Adobe AIR 393

    Part VII       Real-World Projects

    24       Contact Manager with Integrated Yahoo! Maps 411

    25       Peer-to-Peer Photo Sharing Using Adobe AIR, Bonjour, and Java 421

    26       Building a Video Distribution System 427

    Part VIII       Adobe AIR 1.5 and Adobe Flash 10 Extras

    27       Using Adobe Flash 10 Features in Adobe AIR 439

    Appendices

    A        Adobe AIR Resources for Developers 451

    B        Adobe AIR API Reference Poster (Downloadable) 455

    C        Downloading Source Code for Adobe AIR Programming Unleashed 457

    Index 463

    Table of contents

    1. Copyright
      1. Dedication
    2. About the Authors
    3. Acknowledgments
    4. We Want to Hear from You!
    5. Reader Services
    6. Introduction
      1. Who Should Read This Book?
      2. Software Requirements
        1. Adobe AIR
        2. Adobe Flex
          1. Adobe Flex Builder 3 for Windows (Standard and Professional) Requirements
          2. Adobe Flex Builder 3 for Mac OS (Standard and Professional)
        3. Adobe Flex 3 SDK
      3. Code Samples for This Book
    7. I. Getting Started with Adobe AIR
      1. 1. Introduction to Adobe AIR
        1. Conceptual Overview
        2. What Is Adobe AIR?
        3. Looking at the Adobe AIR Architecture
          1. Summary
      2. 2. Setting Up the Development Environment
        1. Installing Adobe AIR
        2. Installing Adobe Flex Builder
        3. Installing the Software Development Kits (SDKs)
          1. Installing Java
          2. Adding Java to Your System Path
          3. Installing Adobe AIR and Adobe Flex SDKs
          4. Summary
      3. 3. Creating an Adobe AIR Application
        1. Your First Adobe AIR Application
        2. Exploring the Application Startup Process
          1. Handling Application Invoke Events
            1. Launching on Login
            2. Launching Applications from the Command Line
            3. Launching from the Browser
          2. Exploring the Application Shutdown Process
        3. Reading Application Settings
        4. Establishing File Associations
        5. Detecting User Presence
        6. Retrieving Version and Patch Information
          1. Summary
      4. 4. Debugging Adobe AIR Applications
        1. Using the Adobe Flex Builder Debugger
        2. Using the Adobe AIR Debug Launcher (ADL) to Debug
        3. Using the Adobe Flash Debugger (FDB) to Debug
        4. Using Third-Party Tools to Debug
        5. Debugging with the Adobe AIR HTML Introspector
        6. Debugging Content Loaded into the HTML Control
        7. Performance and Memory Profiling
          1. Summary
    8. II. Building Adobe AIR Applications
      1. 5. Working with Windows
        1. Windows in Adobe AIR
        2. Creating Windows Using NativeWindow
          1. Setting NativeWindowInitOptions
            1. NativeWindowInitOptions.systemChrome
              1. NativeWindowSystemChrome.STANDARD
              2. NativeWindowSystemChrome.NONE
            2. NativeWindowInitOptions.type
              1. NativeWindowType.NORMAL
              2. NativeWindowType.UTILITY
              3. NativeWindowType.LIGHTWEIGHT
            3. NativeWindowInitOptions.transparent
            4. NativeWindowInitOptions.maximizable
            5. NativeWindowInitOptions.minimizable
            6. NativeWindowInitOptions.resizable
          2. Creating an Instance of the Window
          3. Putting the Window Onscreen
            1. Using NativeWindow.activate()
            2. Using NativeWindow.visible
        3. Creating Windows Using mx.core.Window
          1. Creating an Instance of Window
          2. Setting Window Properties
            1. Chrome Options for mx.core.Window
          3. Opening a Window Onscreen
        4. Getting a Window Reference
          1. Window Constructor
          2. Current Window Stage
          3. Display Object on the Stage
          4. Referencing the Active Window
          5. Referencing All Opened Windows
        5. Window Operations
          1. Resizing a Window
          2. Moving a Window
          3. Maximizing, Minimizing, and Restoring a Window
          4. Closing a Window
        6. Understanding Window Events
          1. Canceling a Window Event
        7. Creating Custom Window Chrome
          1. Summary
      2. 6. Working with Screens
        1. The Virtual Desktop
        2. Determining the Number of Screens
        3. Obtaining a Reference to the Main Screen
        4. Determining Screen Resolution
        5. Positioning Windows Programmatically
        6. Using Full-Screen Mode
          1. Summary
      3. 7. Working with Files and Directories
        1. Determining File or Directory Paths
          1. Understanding File.url
          2. Understanding File.nativePath
        2. Opening and Reading a File
          1. Synchronous Versus Asynchronous File Operations
          2. Using FileMode
        3. Creating and Writing a File
        4. Working with Directories
          1. Creating a New Directory
          2. Creating a Temporary Directory
          3. Deleting a Directory
          4. Retrieving a Directory Listing
          5. Summary
      4. 8. Understanding the Drag-and-Drop API
        1. Examining the Drag-Out Gesture
        2. Examining the Drag-In Gesture
          1. Summary
      5. 9. Working with Copy and Paste
        1. Meet the Adobe AIR Clipboard Classes
          1. Using the TEXT_FORMAT Data Type
          2. Using the BITMAP_FORMAT Data Type
          3. Using the HTML_FORMAT Data Type
          4. Using the FILE_LIST_FORMAT Data Type
          5. Using the URL_FORMAT Data Type
        2. Clipboard Deferred Rendering
          1. Summary
      6. 10. Working with Native Menus
        1. Meeting the NativeMenu Class
          1. Application Menus
          2. Window Menus
          3. Context Menus
          4. Dock and System Tray Menus
          5. Pop-Up Menus
          6. Flex Menus
        2. The Hierarchical Nature of Adobe AIR Menus
        3. A Few More Details for Adobe AIR Menus
          1. Summary
      7. 11. Adding User Notifications
        1. Bounce the Mac OS X Dock Icon—NativeWindow Class
        2. Toast Messages—NativeApplication Class
        3. StatusBar Notifications—NativeWindow Class
        4. Taskbar Highlighting—NativeWindow Class
        5. System Tray Icon ToolTips—NativeWindow Class
          1. Summary
      8. 12. Working with Local Databases
        1. About SQLite in Adobe AIR
        2. Why Use a Local SQL Database?
        3. Creating Database Tables
        4. Working with Database Tables
        5. Working with Database Data
          1. Inserting Data
          2. Retrieving the Primary Key of an Inserted Row
          3. Handling Database Query Results
        6. Synchronous Versus Asynchronous Database Operations
          1. Writing Synchronous Database Operations
          2. Writing Asynchronous Database Operations
        7. Working with Encrypted Databases
        8. Adobe AIR SQLite Tool
          1. Summary
      9. 13. Understanding Networking and Local Connections
        1. Remoting with Flash Remoting and ColdFusion
        2. Using an Adobe Flex HTTPService
        3. Using an Adobe Flex WebService
        4. Messaging with BlazeDS
          1. Installing BlazeDS
          2. Creating an Adobe AIR Messaging Application
        5. Adobe AIR Applications and Local Connections
          1. Summary
      10. 14. Working with Adobe Flex AIR Components
        1. FileSystemComboBox Component
        2. FileSystemList Component
        3. FileSystemTree Component
        4. FileSystemDataGrid Component
          1. Summary
    9. III. Securing Adobe AIR Applications
      1. 15. Understanding Security Sandboxes
        1. Security Sandboxes in Adobe AIR
        2. The Application Sandbox
        3. Using Sandbox Bridges
          1. Summary
      2. 16. Using the Encrypted Local Store
        1. API Reference
          1. Storing Data
          2. Reading Data
          3. Removing Data
        2. Sample Application—Storing Login Credentials
          1. Summary
    10. IV. Deploying Adobe AIR Applications
      1. 17. Distributing Adobe AIR Applications
        1. Installing an Adobe AIR Application—The One-Off Approach
        2. Installing Adobe AIR Applications Seamlessly
        3. Digitally Signing an Adobe AIR File
          1. Summary
      2. 18. Updating Adobe AIR Applications
        1. Meet the Updater Class
        2. Step-by-Step Instructions to Updating an Adobe AIR Application
        3. Update Adobe AIR Applications via a Remote Server
          1. Summary
    11. V. Architecting Adobe AIR Applications
      1. 19. Introduction to Frameworks and Design Patterns
        1. What Is a Framework?
          1. Libraries
          2. Application Framework
          3. Architecture Framework
        2. How an Architecture Framework Helps Adobe AIR Development
          1. Design Patterns
          2. Where to Apply Design Patterns in Adobe AIR
            1. Managing State
            2. Handling User Gestures
            3. Interacting with Services
            4. Transferring Data
            5. Reducing Tight Coupling
        3. Introducing Cairngorm
          1. Microarchitecture
          2. Familiar Concepts
          3. Working Parts of Cairngorm
            1. Value Object
            2. ModelLocator
            3. FrontController and Commands
            4. ServiceLocator
            5. Business Delegate
          4. Summary
      2. 20. Building Adobe AIR Applications Using the Cairngorm Microarchitecture
        1. Defining the Model and Value Objects
          1. Product.as
          2. CartItem.as
          3. CartModel.as
        2. Creating the ServiceLocator and Delegate
          1. ServiceLocator
          2. ProductDelegate.as
        3. Creating Commands, Events, and the FrontController
          1. LoadProductsEvent.as
          2. LoadProductsCmd.as
          3. PrepAddCartCmd.as
          4. CancelAddCmd.as
          5. AddItemCmd.as
          6. CartController.as
        4. Building the Views
          1. ecart.mxml
          2. CartView.mxml
          3. AddItemView.mxml
          4. Summary
    12. VI. Agile Development with Adobe AIR
      1. 21. Creating a Build Process
        1. Installing Apache Ant
          1. Downloading and Configuring Apache Ant
          2. Downloading and Installing Adobe Flex Ant Tasks
        2. Creating Your Project’s build.xml
          1. Compiling Your Adobe AIR Application
            1. Compiler Background Information
            2. Writing the build Target
          2. Running Your Adobe AIR Application
          3. Exporting Your Adobe AIR Application
          4. Creating a Self-Signed Certificate for Testing
          5. Project’s Final build.xml
          6. Running Your build.xml
            1. Compiling
            2. Running
            3. Exporting
            4. Anatomy of an .air Distributable Archive
          7. Summary
      2. 22. Incorporating Unit Testing
        1. Introducing FlexUnit
          1. Downloading FlexUnit
          2. Downloading FlexUnit Ant Tasks
          3. Creating a Test Case
            1. Naming Conventions
            2. Implementing the setUp() and tearDown() Methods
          4. Running Your Test Case
            1. Adding Your Test Case to a Test Suite
            2. Creating a Visual Test Case Runner
          5. Asynchronous Testing
            1. Where Asynchronous Testing Comes into Play
            2. Asynchronous Test Example
        2. Integration with Apache Ant
          1. Running FlexUnit from Apache Ant
            1. Modifications for Apache Ant Compatibility
            2. Compiling the Unit Tests
            3. Running the Unit Tests
          2. Unified Reporting with JUnit
          3. Summary
      3. 23. Continuous Integration with Adobe AIR
        1. Overview of Continuous Integration
          1. Version Control System
            1. Mainline, Checkout, and Commits
            2. Branches and Merging
          2. Daily Commits
          3. Automated Build
          4. Unit Testing
          5. Automated Deployment
        2. Introducing CruiseControl
          1. Downloading CruiseControl
          2. Configuring CruiseControl
          3. Using CruiseControl
            1. Starting CruiseControl
            2. CruiseControl Dashboard
            3. Rebuilding
              1. Automatic Rebuild
              2. Forcing a Build
          4. Summary
    13. VII. Real-World Projects
      1. 24. Contact Manager with Integrated Yahoo! Maps
        1. Contact Manager with Integrated Yahoo! Maps Application Overview
        2. Using Third-Party Components
          1. Cairngorm Microarchitecture Framework
          2. PromptingTextInput
          3. Yahoo! Maps
        3. Online/Offline Synchronization
          1. Embedded Database
          2. Handling the Offline Scenario
          3. Summary
      2. 25. Peer-to-Peer Photo Sharing Using Adobe AIR, Bonjour, and Java
        1. Application Overview
          1. Understanding the Bonjour Protocol
          2. Introducing the Mini Web Server
          3. Integrating Adobe AIR and Java via Adobe Flash Socket Connections
          4. Summary
      3. 26. Building a Video Distribution System
        1. Application Overview
        2. Working with Adobe ColdFusion
          1. Working with LiveCycle Data Services
          2. Summary
    14. VIII. Adobe AIR 1.5 and Adobe Flash 10 Extras
      1. 27. Using Adobe Flash 10 Features in Adobe AIR
        1. Using 3D Rotation Effects
        2. Working with Display Objects and the Z-Axis
          1. Summary
    15. IX. Appendices
      1. A. Adobe AIR Resources for Developers
        1. IDEs
        2. Server-Side Technologies
        3. Security
        4. Mailing Lists
        5. Build Tools
        6. Testing
        7. Continuous Integration
        8. Version Control
        9. Development Resources
        10. Libraries Used in Our Projects
        11. Blogs and Publications
      2. B. Adobe AIR API Reference Poster (Downloadable)
      3. C. Downloading Source Code for Adobe AIR Programming Unleashed
        1. Installing the Subversion Plug-In for Adobe Flex Builder
        2. Downloading the Zip Archive

    Product information

    • Title: Adobe AIR Programming Unleashed
    • Author(s):
    • Release date: November 2008
    • Publisher(s): Sams
    • ISBN: 9780768680645