You are previewing Breaking Out of the Web Browser with Adobe AIR.
O'Reilly logo
Breaking Out of the Web Browser with Adobe AIR

Book Description

With the introduction of Adobe AIR, Flex developers have more capability than ever before. Now you can build dynamic applications that combine the rich experience of a traditional desktop application with the power of the Internet. Leveraging your existing knowledge of Adobe Flex and Flash, Breaking out of the Web Browser with Adobe AIR will help you build well-architected desktop applications. Flex and Flash experts Jeff Tapper and Michael Labriola will teach you techniques to create truly custom interfaces by leading you through exercises with a real world time-tracking application. The book’s abundance of examples will help you become adept at interacting with the end user’s underlying operating system and teach you the most important concepts for using AIR.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. Bios
  4. Foreword
  5. The Genesis of AIR
    1. Legacy Era
      1. Mainframe Era
      2. Microcomputers
      3. Client/Server
    2. Internet Era
      1. Early Browser Applications
      2. Rich Internet Applications
        1. AJAX-based applications
        2. Flash Player–based applications
    3. Break Out of the Browser
      1. Limitations of Browser-Based Applications
        1. Browser sandbox limits application functionality
        2. Browser native behavior intrudes on application controls
        3. Browser applications rarely work while disconnected
      2. AIR Breaks Out of the Browser
    4. Prerequisites
    5. Outline
    6. Who Is This Book For?
    7. The Project Application
    8. Standard Elements in the Book
  6. 1. Building Your First AIR Application
    1. How to Build AIR Applications
      1. Building a Hello World Application with AIR and Flex
      2. Building a Hello World Application with AIR and HTML
      3. Describing Your Application with an Application Descriptor
      4. Testing Your Application
        1. Testing your application with the command line tools
        2. Testing your application from an IDE
      5. Debugging Your Application
    2. Packaging Your Application for Deployment
      1. Using the AIR Developer Tool (ADT) to Package Your Application
      2. Using Flex Builder to Package Your Application
    3. Next Steps
  7. 2. Working with the Time Tracker Application
    1. Getting Started with dpTimeTracker
      1. Downloading the dpTimeTracker Code
      2. Importing the Project
      3. Using the Application
    2. Getting Started with the Flex Builder Debugger
      1. Breakpoints
      2. Trace Statements
    3. Understanding the Application Framework
    4. Next Steps
  8. 3. Interacting with the Clipboard
    1. Integrating with the Operating System
      1. Interacting with the Clipboard
    2. Exploring the Clipboard Class
      1. Understanding Clipboard Data Formats
      2. Creating Custom Formats
      3. Understanding Clipboard Transfer Modes
      4. Understanding Data Serialization
      5. Deferred Rendering
    3. Exploring the dpTimeTracker Use of the Clipboard
    4. Next Steps
  9. 4. Implementing Drag and Drop Between the OS and AIR
    1. Drag and Drop in an Application (DragManager Class)
    2. Drag and Drop Between the OS and the Application (NativeDragManager)
    3. Drag and Drop Items into an AIR Application from the OS
    4. Drag Items into the dpTimeTracker Application
    5. Drag Items from an AIR Application to the OS
    6. Drag Items into the OS
    7. Next Steps
  10. 5. Reading and Writing to a SQLite Database
    1. Introducing SQLite
      1. SQLite Features
      2. Data Types
      3. Limitations
    2. Accessing SQLite from AIR
      1. Communicating Synchronously or Asynchronously
      2. Opening and Creating a SQLite Database
        1. Using responders instead of events
      3. Executing SQL Statements
        1. Retrieving results
        2. Queuing SQL statements
      4. Closing a Database Connection
      5. Creating a Database and Tables
        1. Creating a table
        2. Altering and dropping tables
        3. Compacting a table
        4. Viewing the database schema
      6. Selecting Data from Your Database
        1. Using itemClass
        2. Selecting from multiple databases
      7. Inserting Data into Your Database
        1. Using parameters
        2. Retrieving a database created primary key
      8. Updating and Deleting Data
      9. Using Transactions
    3. Optimizing Database Performance
      1. Using Analyze
      2. Optimizing SQLStatement
    4. Understanding Database Access in the dpTimeTracker Application
      1. Using the SQL Command
        1. Executing the command
        2. Using callbacks
      2. Sequencing SQL Commands
      3. Inserting and Updating Using SQL Commands
    5. Next Steps
  11. 6. Interacting with the File System
    1. Understanding File Classes
      1. Referencing the File Location
      2. Interacting with the File Contents
      3. Specifying File Actions
    2. Accessing Files Synchronously or Asynchronously
    3. Accessing File System Information
      1. Specifying Paths
      2. Determining the OS-Specific Line Ending
      3. Specifying File Paths as URLs
      4. Using Special Directories
        1. Interacting with the user directory
        2. Using the User’s documents directory
        3. Working with the user’s desktop directory
        4. Working with the application directory
        5. Referencing the application’s storage directory
    4. Using Error Handling
    5. Working with Directories
      1. Actions
        1. Browsing the directories
        2. Creating a directory
        3. Deleting a directory
        4. Listing contents of a directory
      2. File and Directory Events
      3. Using the FileStream Class
        1. Understanding file modes
        2. Reading a file
        3. Reading in ID3v1 data from an MP3
        4. Writing a file
        5. Appending data to the end of a file
        6. Reading and writing to a file
    6. Exploring the File Class Further
      1. Browsing Files
      2. Deleting Files
      3. Copying, Moving, or Renaming Files
      4. Writing ActionScript Objects to the File System
        1. Saving object state
    7. Looking at the dpTimeTracker Example
      1. Creating the Excel File
      2. Reading the SQLite File
    8. Next Steps
  12. 7. Customizing the Look and Feel of an Application
    1. Understanding the Differences between the Flex and AIR APIs
      1. Using Styles
      2. Using Skins
      3. Using the Window API
        1. Working with the NativeWindow class
        2. Creating new windows
    2. Working with Menus
      1. Application and Window Menus
      2. Context Menus
      3. OS Menus
    3. Exploring the Customizations in the dpTimeTracker
    4. Next Steps
  13. 8. Working with the Presence API
    1. Understanding and Detecting Network Presence
      1. Detecting a User’s Connection
        1. Making the Presence API available
        2. Detecting connectivity changes
      2. Understanding the URLMonitor
      3. Understanding the SocketMonitor
    2. Understanding and Detecting User Presence
      1. Why Should I Care about User Presence?
      2. Tracking User Presence
    3. Building Auto-Update Features into an Application
      1. Working with the Updater Class
        1. Downloading an update
        2. Installing an update
    4. Reviewing the Auto-Update Features in dpTimeTracker
    5. Next Steps
  14. 9. Using HTML Content in a Flex/AIR Application
    1. Introducing WebKit
      1. AIR Extensions to WebKit
        1. HTML Extensions
        2. Security
      2. JavaScript in WebKit
      3. AIR API Access from JavaScript
      4. ActionScript Objects in JavaScript
      5. JavaScript DOM from ActionScript
      6. HTMLLoader
    2. Working with Events
      1. DOM Events
      2. Handling Events in JavaScript
      3. JavaScript Exceptions
    3. Controlling HTML Content
      1. Scrolling
      2. Working with the History List
    4. Using HTMLHost
    5. Opening HTML Content in the OS Default Browser
    6. Adding PDF Content
      1. Detecting PDF Capabilities
      2. Loading PDF Files
      3. Knowing PDF Limitations in AIR
    7. Exploring the Use of HTML in the dpTimeTracker Application
    8. Next Steps
  15. 10. Understanding the Need for Remote Data
    1. Why Use a Server?
      1. What Kind of Server Can You Use?
        1. Downloading files
        2. Using Request/Response (RPC)
      2. SOAP
      3. REST/XML
      4. Action Messaging Format (AMF)
      5. Real-Time Messaging Protocol (RTMP)
      6. Sockets
    2. Using Design Patterns when Working with a Server
      1. Role of AsyncToken
      2. Role of Service Interfaces
      3. Role of Stub Data
      4. Role of a ServiceFactory
    3. Using Remote Data in the dpTimeTracker Application
      1. Exploring the Synchronization with Harvest
      2. Exploring the Versioning System
    4. Next Steps
  16. 11. Communicating with Adobe BlazeDS
    1. The Role of BlazeDS
    2. How to Get BlazeDS
    3. BlazeDS Architecture Basics
    4. Configuration Files
    5. Remote Procedure Calls
      1. Configuring BlazeDS to Use RemoteObjects
      2. Using the Destination in a Client
      3. Mapping Java and ActionScript Types
    6. Publish/Subscribe Messaging
      1. Configuring BlazeDS to Use Messaging
        1. Streaming AMF
        2. Polling AMF
      2. Using the Destination in a Client
        1. Filtering with selectors
        2. Using subtopics
        3. Using MultiTopic Consumers and Producers
    7. BlazeDS and LiveCycle Data Services
    8. Next Steps
  17. 12. Testing AIR Applications with Fluint
    1. Types of Testing
    2. Testing Frameworks
      1. Understanding Fluint
      2. Installing Fluint
        1. Installing the pre-compiled library
        2. Building the library
    3. Framework Terminology
      1. Test Method
      2. Test Case
      3. Test Suite
      4. Test Runner
    4. Creating Basic Unit Tests
      1. Creating Test Cases and Methods
      2. Organizing Test Directories
    5. Creating Asynchronous Tests
      1. Implementing Simple Setup and Teardown
      2. Creating a Simple Asynchronous Test Method
      3. Using Pass-Through Data
    6. Creating Integration Tests
      1. Creating a Simple UIComponent Test
        1. Overriding the setup and teardown behavior
        2. Writing the test method
        3. Creating a reusable handler method
      2. Working with Test Sequences
        1. Creating the login form
        2. Setting up the test case
        3. Writing the test sequence steps
        4. Exploring other sequence steps
      3. Working with Responders
    7. Next Steps
  18. 13. Deploying AIR Applications
    1. Using a Digital Certificate
    2. Purchasing a Thawte Certificate
    3. Configuring Application Options
      1. Installer Text
      2. Installation Directory and Menu Location
      3. File Types
      4. Browser Invocation
      5. Icons
      6. Assembled
    4. Packaging an AIR Application
      1. Packaging with Flex Builder
        1. Signing an AIR application
        2. Including files and assets
        3. Including a database
      2. Packaging with the Command Line
      3. Signing an Intermediate File
      4. Migrating an AIR File
    5. Distributing an AIR Application
      1. Using the Seamless Badge Install
      2. Customizing the Badge
      3. Using Express Install
      4. Using Pre-Customized Badges
    6. Next Steps
  19. 14. Understanding AIR Security
    1. Web and Desktop Security Differences
    2. AIR Security Specifics
    3. Sandboxes
    4. Restrictions on the Application Sandbox
      1. Flex/ActionScript
        1. No access to persistent cache
        2. HTML content in an ActionScript TextField
        3. Dynamic code with ActionScript
      2. HTML/JavaScript
        1. Dynamic code with JavaScript
        2. XMLHttpRequest
        3. Windowing
    5. Permissions for Non-Application Sandboxes
      1. XMLHttpRequest
      2. Windowing
    6. Cross-Sandbox Communication
    7. The Encrypted Store
    8. Encrypted Store in the Time Tracker Application
    9. Worst Practices
      1. Using Input or Dynamic Data as Parameters
        1. Using SQL injection
        2. Allowing file manipulation
        3. Allowing code injection
      2. Betraying Trust in Your AIR Package
        1. Self-signing your application
        2. Including untrusted or unused files in the AIR file
        3. Forgetting about upgrading your application
    10. Next Steps
  20. A. Getting Started with AIR
    1. AIR Tools
      1. Runtime System Requirements
      2. Installing the AIR Runtime
        1. Installing on Windows
        2. Installing on Mac OS
      3. Getting the SDK
      4. Getting Flex Builder
  21. B. Considerations for Working with AIR 1.1
    1. Updating the Flex SDK
    2. Instructing Flex Builder 3 to Use a Different SDK
    3. Modifying the Application Descriptor