Back to description
A reliable development environment will save you loads of time when you are ready to debug and deploy your applications.... more
A reliable development environment will save you loads of time when you are ready to debug and deploy your applications. This chapter explains how to install and use command-line tools in building an AIR (Adobe Integrated Runtime) application. This chapter follows a slightly different format than the following chapters, as it introduces the development process in building applications in AIR, and provides an overview of common tools.
The following section, “SDK Installation,” explains where to download and how to install the Flex 3 SDK, which includes all required tools and APIs (Application Programming Interfaces) to build Flex and AIR applications. This section covers the basics of the development environment and provides a brief overview of the command-line tools that are used throughout the book to deploy AIR applications.
The section “Building Your First Application” walks you through the process of building your first AIR application, focusing on how to use the command-line tools to deploy, debug, and package your application for installation.
The section “Installing and Uninstalling” explores the installation process of an AIR application and the storage of application files on a user’s machine.
The final section, “Extra Tools,” addresses two additional ways for developers to ease the development process: an Apache Ant build scheme to help automate the build process and a simple debug panel to receive basic trace statements from AIR applications.
... less
With any new technology that has a file system API, you’re probably wondering just how you would read and write files to... more
With any new technology that has a file system API, you’re probably wondering just how you would read and write files to your hard drive. There is probably no better way to learn this than to write the most versatile program of all time: The Almighty Text Editor. Granted, everyone has their own favorite text editing program that they’ve been using for years, especially if you’re any sort of developer. The text editor you’ll develop in this chapter is by no means a program that will replace your existing text editor, but perhaps it will be the start of your own customized text editor that you later extend with all the wonderful functionality that your current text editor is missing!
This program illustrates a few important things about the AIR file system API. First you’re going to work with the File object to point to files on your hard drive. The chapter then covers how to use the FileStream and FileMode classes to read from and write to a file (in this case, text files). Lastly, you will learn how to use the FileFilter class to limit the types of files the user is allowed to open.
File
FileStream
FileMode
FileFilter
Everyone tries to keep abreast of the latest news. As a newspaper is an aggregate of articles in print, a Really Simple Syndication... more
Everyone tries to keep abreast of the latest news. As a newspaper is an aggregate of articles in print, a Really Simple Syndication (RSS) reader supplies you with information in a digital format. The RSS format is an XML markup delivering information about a feed, or collection of published articles, detailed through metadata elements. Online aggregators are notified of updates from multiple RSS feeds and facilitate staying up to date on what interests you from various sources.
In this chapter, you will build a simple RSS reader that displays posts from the Adobe XML News Aggregator (AXNA), an aggregate of various topics, including the lowdown about the latest information on the Flash Platform. While doing so, you’ll uncover some more jewels in the AIR API as they pertain to network connectivity, the system tray, and windows.
Before you begin building the application, first consider what to expect from a desktop RSS reader. In general, the RSS reader should have the following qualities:
Be aware of network resources and user presence, and handle polling the RSS feed accordingly
Unobtrusively display posts as they are received from the RSS feed
Present additional options pertaining to the application and RSS feed from the system tray
The next section discusses how to achieve these goals.
Let’s face it: There are a lot of music players on the market. Programs such as Apple iTunes and Windows MediaPlayer control... more
Let’s face it: There are a lot of music players on the market. Programs such as Apple iTunes and Windows MediaPlayer control a large share of that market. Nevertheless, this does not mean there isn’t room for another. Each existing player has features that make it stand out compared to others, but you might want a combination of features currently unavailable from any one player. This is your opportunity to create the next killer music app.
In this chapter, you will create a music player called airAMP, named after one of the first widely used MP3 programs. The intention of this exercise is to create one with the basic playback features, which you can use to build a more robust, full-featured music player. airAMP will utilize the AIR API to search a chosen directory for MP3 files that will populate a playlist. It will write the playlist back to the user’s hard drive as an XML file. Additionally, it will leverage the AIR API’s capability to create an application that is moderately styled and chromeless.
Through building this application, you will learn how to use several features within the Flex and AIR APIs, including the following:
Utilizing the File class to select a directory
Recursively searching a directory and its subdirectories for a file type (MP3)
Utilizing the FileStream class to read and write to an XML file
Creating an application that does not rely on the AIR chrome-window controls
Loading, playing, and reading ID3 tags of MP3s using ActionScript
The next section discusses the design concepts behind developing airAMP.
Making a content management system (CMS) in AIR is a fantastic idea. What could be better than a cross-platform desktop application... more
Making a content management system (CMS) in AIR is a fantastic idea. What could be better than a cross-platform desktop application that enables you to manage remote content? OK, a lot of things are better, but in the context of AIR, the CMS is a pretty snazzy possibility. The application you will create in this chapter should give you a good start on creating a simple CMS application. You could approach the creation of a CMS in many different ways, but in this case the application is going to be kept rather simple, as it is hoped that it serves as a stepping-stone for creating a CMS of your own that is specific to your needs.
In this chapter, the application will enable you to manage a remote XML data set and its associated assets. The data set that the application manages is a hypothetical list of items that resembles a simple list of article or journal entries. Each item in the list also contains an associated image file. The application will enable you to edit, add, and delete items from the list. After you are done editing the content, the application uploads the new data set and any images that you selected from your local hard disk to the remote storage area.
The following section discusses the design of the application. This includes the logistics of managing the data and the components that are necessary for the user interface. After design, you’ll get into the code and learn about the important classes and functions that will tie everything together.
If you’re like most of us, you probably have dozens, if not hundreds of image files in various folders on your computer.... more
If you’re like most of us, you probably have dozens, if not hundreds of image files in various folders on your computer. You let these files freeload on your disk space because you know you will someday look at them again and maybe make a few adjustments. Looking at these images through a file browser can be an unrewarding experience. Perhaps if you had some type of photo displaying apparatus, you wouldn’t forget about these works of art.
The image viewing application you build in this chapter will remind you of those precious moments and enable you to make adjustments to them. This program illustrates some important features of the AIR drag-and-drop API while continuing to delve into features available in the file system API discussed in the previous chapters.
In addition to displaying a single image, the application can display a bank of imported image files, enabling users to navigate through multiple images and select only what is wanted. With this capability in mind, the Image Viewer and Editor will handle multiple ways for adding to this preview bank, including the following:
Importing all image files found in a chosen directory
Importing multiple image files from a single directory
Importing image files that have been dragged and dropped onto the application
The capability to save edited image files is a crucial part of the application as well, and includes the following:
Overwriting an imported image file
Saving an image to a chosen directory
Saving an image by dragging it from the viewer into a directory
The next section discusses the plan to achieve these goals.
Now that you have a basic understanding of the HTML component, it’s a good time to center an application around it, and a... more
Now that you have a basic understanding of the HTML component, it’s a good time to center an application around it, and a perfect program would be an HTML and CSS editor. As with the text editor from Chapter 2, it’s probably safe to assume that everyone has their own favorite editor for both HTML and CSS. In an attempt to make this program unique, the application you will create in this chapter will allow the user to edit the HTML and CSS of any page, online or offline. Essentially, it will be a very basic web browser with the capability to edit the current page’s HTML and CSS source. Just think of the possibilities you’ll have with regard to editing the source of your favorite web page without having to save all the assets to your computer.
The main objective of this program is to illustrate just how easy it is to manipulate the JavaScript Document Object Model (DOM) of any HTML page that is loaded into the AIR HTML component. Do not fret if your JavaScript skills aren’t up to snuff because all the code will look very familiar. Remember that ActionScript and JavaScript are both based on ECMAScript. The program will use the same techniques from Chapter 2 to enable users to export the edited HTML and CSS, which are just plain text files, to their hard drive.
Specifically, the application will need to perform the following tasks:
Load and display an HTML page from a URL
Load and display an HTML page from the user’s hard drive
Display the HTML source within the <BODY> tag of the loaded page
<BODY>
Display a selectable list of all the CSS styles from the loaded page
Display a selectable list of all the properties of a particular style
Enable users to edit the HTML source of the current page
Enable users to add and edit styles for the current page
Enable users to add, edit, and delete properties for a selected style
Enable users to save the HTML and CSS source to their hard drive
Enable users to revert back to the original source
Now that you have a nice laundry list of actions the program should perform, it’s time to assess what you have at your disposal to achieve this particular functionality.
Widgets, or desktop applets you interact with, are everywhere. With programs such as Yahoo’s Konfabulator, Google’s Desktop... more
Widgets, or desktop applets you interact with, are everywhere. With programs such as Yahoo’s Konfabulator, Google’s Desktop Gadgets, Microsoft Vista’s Sidebar, and Apple’s Dashboard, widgets have grown in popularity. Every operating system has at least three different choices of widget engines. However, no one brand seems to be simple to develop and easy to distribute, especially across all platforms. Even if one particular widget is easy to program, you are still left wondering whether the end-user has the particular system installed on their computer. The best option is to create the same widget for at least Microsoft Vista’s Sidebar and Apple’s Dashboard, except you’re still left wondering about everyone running Microsoft Windows XP. Given this conundrum, you might conclude that this niche market is a mess.
You could create a widget using the Adobe AIR APIafter all, it’s what this chapter is about. Why would you create a widget using AIR and not one of the other systems available for widgets? Because of the volume of AIR applications being developed by both large companies and independent developers, the probability of the end-user having the Adobe AIR installed on their computer is pretty high. This can be said for Windows, OS X, and Linux platforms. Therefore, AIR enables you to develop a widget using a familiar set of tools (Flex, ActionScript, and the AIR API) and reach a larger audience with minimal effort.
This chapter takes an in-depth look at creating a widget that retrieves the weather for a particular location. Although this is a fairly common type of widget, it serves as a basis from which you can develop future widgets in AIR. This chapter discusses the following Flex/AIR concepts for building a widget:
Creating a “chromeless” application that is always in front of other applications
Utilizing minimize()and restore()commands to hide and show the application
minimize()
restore()
Creating dynamic icons and menus for Microsoft Windows’s System Tray and Mac OS X’s dock
Map applications are prevalent in today’s online location-based activity. Whether you are looking for directions, locating... more
Map applications are prevalent in today’s online location-based activity. Whether you are looking for directions, locating the nearest hotels to your destination, or just seeing what it looks like to be a bird flying over your town, you are requesting information from one of the various services online that can tell you what turn to make, where to stay, and where to land. Many of these services have a public API that application developers can use to integrate into their own applications.
The map application you will build in this chapter will enable you to search for locations using one such online map API, add destination markers to locations, and view and edit saved destinations without regard to an available network resource. This program will continue to delve into the database API discussed in previous chapters and introduce you to bridging code between ActionScript and JavaScript in communicating with an online service.
Before you begin building the application, you should consider what you expect from a desktop map application. In order to utilize an online service to retrieve map information, the following goals should be addressed:
Communication with an online API through JavaScript to search for locations and add destinations
Communication with a local database to save, view, and edit destination information
If you’ve ever wanted to write a blog entry when your computer wasn’t connected to the Internet, you wouldn’t be alone. To... more
If you’ve ever wanted to write a blog entry when your computer wasn’t connected to the Internet, you wouldn’t be alone. To get around this situation, you’ve probably written your entry and saved it to some sort of text file for later posting. When your computer was connected to the Internet again, you probably logged into your blogging service, navigated to the compose entry page, opened your text file, and then finally copied and pasted the text into the form. That certainly doesn’t feel very efficient. Surely there is a better way.
Luckily, most blogging services and blogging software offer some sort of web services that enable third-party software and applications to communicate with them. This chapter will utilize Google’s Blogger service (www.blogger.com). Blogger is a simple blogging service that has a very useful data API that enables third-party applications to retrieve and send various pieces of data through simple GET and POST requests. The application you will build in this chapter utilizes this service combined with functionality available in Adobe AIR to avoid the inefficient process described in the previous paragraph. If you do not already have an account with Blogger, it would be best to create one before you begin this chapter.
www.blogger.com
The following section discusses the design of the application. This includes the logistics of managing the data and the components that are necessary for the user interface. After design, you’ll get into the code and learn about the important classes and functions that tie everything together.
Since the dawn of what is commonly referred to as the Projector Age, vacations and slideshows have gone hand in hand. While... more
Since the dawn of what is commonly referred to as the Projector Age, vacations and slideshows have gone hand in hand. While the popularity of taking pictures of the same object from different angles did not coincide with this period, being able to show them singled out and blown up has. In this chapter you will build an AIR application that enables you to create individual slides and organize slideshows to capture those very special moments in a sequence. (While slideshows are fun to create, they are not always fun to be subjected to. The examples in this chapter do not present an algorithm for keeping people from wondering whether the slideshow will ever end.)
The application will enable you to save your work on that ovation-inspiring slideshow, to continue working either from the same computer at a later date or on another computer with the application installed. This program introduces invoking your application using associated file types as well as OS-level notifications. In continuing with your knowledge of the AIR file system API, you will also learn how to serialize objects to a file.
Along with creating individual slides and organizing the order of a slideshow, the application has multiple displays as they pertain to creating and presenting a slideshow. With this in mind, the Slideshow Maker will handle the following actions:
Switching between a workspace and a presentation
Navigating through a slideshow presentation
Alerting a user to unsaved changes in a slideshow prior to closing the application
The capability to save and open individual slides and slideshows is also a crucial part of the application and entails the following:
Opening and saving slideshows
Importing and exporting single slides
Invoking the application to open slide and slideshow files associated with the application
The past ten years have seen many attempts at bringing video to the Internet. Both web-based and desktop-based applications... more
The past ten years have seen many attempts at bringing video to the Internet. Both web-based and desktop-based applications have risen and fallen with usage trends, while a few competitors have stood their ground. However, with every new player, there is a new data format and another sector of people supporting only that technology. The result is a machine that has far too many applications that do the same thing. The latest release of Flash Player’s support of the H.264 codec in combination with Flex 3 and AIR will, with any luck, push the Internet industry into using one video format.
In this chapter, you will build a desktop video player that supports both FLV and H.264 video formats. It will have all the basic functionality of a desktop video player such as play, pause, rewind, full-screen support, volume, and timeline scrubbing controls. The intention of this chapter isn’t necessarily to create a video player with a lot of bells and whistles, but to familiarize you with some of the main features of the AIR API. It is hoped that this gives you some ideas for adding your own touch to this application.
While building the video player, the following features in the AIR and Flex APIs are discussed:
Utilizing the Flex VideoDisplay component
VideoDisplay
Creating contextual and application menus
Accessing files from both a system browser window and drag-and-drop events
Switching between normal and full-screen display states
The next section discusses the design of the video player.
Purchase Before purchasing this product, please be sure you have met all software and system requirements, and that you understand any limits placed upon its use.
Return Policy Wrox Chapters on Demand are non-returnable and non-refundable.
Reader Software Wrox Chapters on Demand are offered as PDFs, and they must be viewed using the Adobe Reader. If you do not have the Reader installed, it can be downloaded for free at Adobe.com.
Test Download As Wrox Chapters on Demand purchases are non-returnable, it is advisable that you test your system and software configurations with a free sample download before you place an order.
Usage Rights for a Wrox Chapter on Demand File Any Wrox Chapter on Demand product you purchase from this site will come with certain restrictions that allow Wiley to protect the copyrights of its products. After you purchase and download this title, you:
If you have any questions about these restrictions, you may contact Customer Care at (877) 762-2974 (8 a.m. - 5 p.m. EST, Monday - Friday). If you have any issues related to Technical Support, please contact us at 800-762-2974 (United States only) or 317-572-3994 (International) 8 a.m. - 8 p.m. EST, Monday - Friday).
Related Books