List of Listings

Chapter 1. Introducing Adobe AIR

Listing 1.1. The MXML document for the Flex quick-start

Listing 1.2. The code for the document class for the Flash quick-start

Chapter 2. Applications, windows, and menus

Listing 2.1. Creating a NativeWindow object

Listing 2.2. Opening the new window

Listing 2.3. Adding content to the window

Listing 2.4. Adjusting the scale and alignment of the contents of a new window

Listing 2.5. Creating a basic window class

Listing 2.6. Creating and opening an instance of ExampleWindow

Listing 2.7. Creating a nonrectangular window

Listing 2.8. Creating a new window using Flex

Listing 2.9. Opening a window is as simple as calling the open() method

Listing 2.10. Creating a simple window component

Listing 2.11. Creating an instance of the window component

Listing 2.12. Creating a transparent window in Flex with systemChrome set to none

Listing 2.13. Setting showFlexChrome to false to hide the Flex window chrome

Listing 2.14. Positioning a new window from the window that instantiates it

Listing 2.15. Positioning a window from within the window component

Listing 2.16. Centering the application on the screen

Listing 2.17. Snapping a window to the edge of the screen

Listing 2.18. You can’t reopen a window that has been closed

Listing 2.19. Allowing a user to hide and show a window

Listing 2.20. Closing windows on application exit

Listing 2.21. Moving utility windows to the front along with the main window

Listing 2.22. Enable dragging on a window using startMove()

Listing 2.23. Resizing a window

Listing 2.24. Alerting the user if the main window isn’t active

Listing 2.25. Opening a window in full-screen mode

Listing 2.26. Adjusting the scale mode and alignment of a full-screen window

Listing 2.27. Creating application or window menus

Listing 2.28. Adding a context menu

Listing 2.29. Adding a pop-up menu

Listing 2.30. The AirTubeVideo class

Listing 2.31. The ApplicationData class

Listing 2.32. The AirTubeService class

Listing 2.33. The AirTubeService class with the proxied service requests

Listing 2.34. The YouTubeFlvUrlRetriever class

Listing 2.35. The configureVideoForPlayback() method

Listing 2.36. AirTube.mxml

Listing 2.37. Adding search behavior to AirTube.mxml

Listing 2.38. VideoTileRenderer.mxml

Listing 2.39. Using a custom item renderer with the tile list

Listing 2.40. VideoWindow.mxml

Listing 2.41. HTMLWindow.mxml

Listing 2.42. Updating AirTube.mxml with the windows

Chapter 3. File system integration

Listing 3.1. Sample synchronous code

Listing 3.2. Asynchronous statement execution

Listing 3.3. Retrieving a directory listing synchronously

Listing 3.4. Retrieving a directory listing asynchronously

Listing 3.5. Reading the directory listing for the user’s desktop directory

Listing 3.6. Native paths of common directories

Listing 3.7. Listening for select events to determine when a user selects a file

Listing 3.8. Result of browseForOpenMultiple() can be a selectMultiple event

Listing 3.9. Using canonicalize() to correct the case of a path

Listing 3.10. Asynchronous directory listing example

Listing 3.11. Document class for a Flash-based desktop organizer application

Listing 3.12. Moving files to new directories based on file extension

Listing 3.13. Downloading a file and reading the bytes

Listing 3.14. Using the readUTFBytes() method of a FileStream object

Listing 3.15. Writing to a log file using writeUTFBytes()

Listing 3.16. The Playlist class

Listing 3.17. The ApplicationData class

Listing 3.18. The PlaylistService class

Listing 3.19. The PlaylistMaker document

Listing 3.20. Adding the downloadProgress to the ApplicationData class

Listing 3.21. Adding the saveToOffline() to the AirTubeService class

Listing 3.22. Updating VideoWindow.mxml to support downloading videos

Chapter 4. Copy-and-paste and drag-and-drop

Listing 4.1. Setting up the basic structure for a copy-and-paste application

Listing 4.2. Adding a menu to the application

Listing 4.3. Copying the selected text

Listing 4.4. Taking a snapshot and writing it to the system clipboard

Listing 4.5. Pasting text into the current text area

Listing 4.6. Testing whether data exists can save on computation

Listing 4.7. Adding a cut option to the menu

Listing 4.8. The Address class we use to store address data

Listing 4.9. The address creator application

Listing 4.10. The address viewer application

Listing 4.11. Initiating a native drag operation

Listing 4.12. Allowing drops on targets

Listing 4.13. Handling the nativeDragDrop event

Listing 4.14. Adding a drag indicator

Listing 4.15. Aligning the drag indicator to the mouse

Listing 4.16. Dragging an image out of an AIR application

Listing 4.17. Creating an image gallery that supports dragging images

Listing 4.18. Adding drag-and-drop behavior to AirTube

Chapter 5. Using local databases

Listing 5.1. The ToDoItem class is the data model class for to-do items

Listing 5.2. The ToDoListRenderer component displays a to-do item

Listing 5.3. The ToDo.mxml file creates the database and its table

Listing 5.4. Adding an input form to the application

Listing 5.5. Code to add, edit, retrieve, and delete records

Listing 5.6. Adding a display container and handling SELECT results

Listing 5.7. Deleting and editing items

Listing 5.8. Adding an online property to ApplicationData

Listing 5.9. Updating AirTube.mxml with a button to toggle modes

Listing 5.10. Updating AirTubeService to include offline support

Chapter 6. Network communication

Listing 6.1. Using a URLMonitor object to monitor HTTP resource availability

Listing 6.2. Getting the time using a Socket object

Listing 6.3. Adding a networkAvailable property to the ApplicationData class

Chapter 7. HTML in AIR

Listing 7.1. Loading and rendering HTML pages using HTMLLoader

Listing 7.2. Rendering HTML strings as well

Listing 7.3. The location property specifies what HTML to display

Listing 7.4. Accessing the HTMLLoader object using the htmlLoader property

Listing 7.5. Scrolling content using scrollH and scrollV

Listing 7.6. Navigating history using historyBack() and historyForward()

Listing 7.7. HTML code saved in example.html

Listing 7.8. Reading a JavaScript variable

Listing 7.9. Writing the value of a JavaScript variable from ActionScript

Listing 7.10. Assigning reference data types to JavaScript variables

Listing 7.11. Getting a reference to a document object

Listing 7.12. Assigning a function reference to the event handler attribute

Listing 7.13. Using addEventListener() to register event listeners

Listing 7.14. The questionnaire HTML file that displays a survey to the user

Listing 7.15. The document class for the questionnaire application

Listing 7.16. Creating a new scrollable window for HTML content

Listing 7.17. Closing a window by implementing the windowClose() method

Listing 7.18. Resizing a window by implementing a windowRect setter

Listing 7.19. Using CustomHTMLHost in a document class

Listing 7.20. Using a custom HTMLHost implementation

Listing 7.21. Creating a Shape object and adding it to the stage

Listing 7.22. The custom Response class to model questionnaire response items

Listing 7.23. Using the Response class in JavaScript

Listing 7.24. Including the new Response class

Listing 7.25. Using a local HTML file with an iframe to load remote content

Listing 7.26. Calling a function using the bridge

Listing 7.27. Showing HTML content in the HTMLWindow component

Listing 7.28. Setting the url property of the HTMLWindow instance

Listing 7.29. Adding a button to launch HTML from the video window

Chapter 8. Distributing and updating AIR applications

Listing 8.1. Using a class such as this simplifies working with air.swf

Listing 8.2. The descriptor file for UpdatableApplication

Listing 8.3. The main application MXML file for the updatable application

Listing 8.4. Loading the data from the server and parsing it

Listing 8.5. Downloading the .air file using a URLStream object

Listing 8.6. Displaying progress to the user and running the update when available

Listing 8.7. The descriptor file for UpdatableApplication_v2

Listing 8.8. Setting the file type association for AirTube

Listing 8.9. Adding the getVideoById() method to AirTubeService

Listing 8.10. Registering AirTube as the default application for .atv files

Listing 8.11. The invokeHandler() method in AirTube.mxml

Listing 8.12. The main application file displays the parameters passed to it

Listing 8.13. Set allowBrowserInvocation to true in the descriptor file

Listing 8.14. Using a web application to launch the AIR application

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.118.14