by Adobe

Adobe AIR


28 March 2011

Prerequisite Knowledge
Experience with Flash Professional, developing Flash or AIR applications, and knowledge of ActionScript 3 programming. 

Sample files require AIR 2.5 SDK (or later) or Flash Professional CS5.
Required Products
Sample Files
User level
To help developers jump-start their Adobe AIR for TV application development, we are providing several developer application tools that can help you test how your AIR for TV apps perform on a supported smart TV, and also help you understand some of the performance features of the TV hardware as you develop AIR for TV applications. You can download these sample application tools and source files at the top of this page.
If you don't have a supported smart TV, you can still design AIR applications for TV as well as learn best practices by running these AIR applications on your desktop computer:
  • PerfMaster Deluxe contains a variety of performance tests designed to illustrate the performance features of bitmap and CacheAsBitmap acceleration optimally suited for AIR applications for TV
  • FontMaster Deluxe illustrates how to enumerate the fonts available on a target system and display them in a manner that aids font selection from a design perspective
  • HogMaster Deluxe allows you to "hog" all available bitmap memory and visualize the performance impact of running out of graphics memory on a device

PerfMaster Deluxe

The PerfMaster Deluxe application shows the performance of different operations that your AIR application might perform on an image, letting you choose from simple, common capabilities such as moving an image across the screen or rotating it and moving a vector across the screen. It compares different implementations of the same capability.
Suppose you want to move an image but you want to find out if it's faster to move a bitmap, a solid vector, or a vector image. PerfMaster shows you the performance of each option so that you can choose the best one for your application. For example, PerfMaster Deluxe illustrates how bitmap operations, including CacheAsBitmap, are generally highly accelerated on television hardware (see Figure 1).
PerfMaster Deluxe
Figure 1. PerfMaster Deluxe
PerfMaster Deluxe shows you a list of options, each of which lets you test a different kind of image:
  • Bitmap manipulates a bitmap image
  • Image manipulates a vector image created by turning a bitmap to a vector
  • Drawn manipulates a hand-drawn vector
  • Solid manipulates a solid, rectangular vector
Choose from among 58 tests by using the Up and Down arrow buttons on the AIR for TV device remote control (or keys on your desktop computer keyboard) to scroll through the list. As you navigate through the tests, PerfMaster shows a description of the highlighted test on the right side of the screen. For example, next to the test called Sletten Index, you'll see the description, "This calculates Pi using the Gregory-Leibniz series. This performs 50,000 loops each frame."
Once you select the test you want to run, press the OK button on the remote control (or the Enter key on the desktop keyboard) to run the test. The test runs for five seconds. The results appear in the bottom-right corner of the screen. Press the Left arrow to go back to select another test. The result of the test you just ran appears to the right of the test in the test list.
You can also choose to run every test by selecting the first item in the test list, Run All. When you select Run All and press OK (Enter), PerfMaster Deluxe runs each of the 58 tests sequentially. When it completes the tests, PerfMaster Deluxe returns to the list and displays the test results next to the names of each test automatically. Running all the tests this way takes about five minutes, since each test runs for five seconds.

FontMaster Deluxe

You can use FontMaster Deluxe to enumerate available fonts and compare the way that fonts appear on a device (see Figure 2).
FontMaster Deluxe
Figure 2. FontMaster Deluxe
After you open the FontMaster Deluxe application, you'll see a list of font types. Choose the fonts you'd like to compare:
  • All compares all fonts available, whether they're in the current SWF file or on the device
  • Embedded compares only the fonts contained in the SWF file
  • Device compares only the fonts on the device
  • Default compares fonts available everywhere that are selected by the system (default fonts may look different depending on the device you are using)
Use the Up and Down buttons/keys on the AIR for TV device remote control (or on the desktop keyboard) to navigate through each item in the list. Select the one you want to use by pressing the OK button on the remote or the Enter button on the desktop keyboard. You'll see a list of all the fonts in that category.
Use the Up and Down buttons/keys to scroll through the list of fonts and press OK (Enter) to pick a font. The Compare screen shows you the selected font with various ways of displaying it. If you're looking at fonts in the Device category, you can choose between Classic or TLF (Text Layout Framework) versions of fonts.
Here's how you control the font comparisons once you've selected a font:
  • Press the Up key to increase font size to a maximum of 42 points
  • Press the Down key to decrease it to a minimum of 4 points
  • Press the Left arrow key to return to the previous screen

HogMaster Deluxe

The HogMaster Deluxe application illustrates how memory consumption grows as images are used in your application. Using the arrow keys, you can add various sized images to the stage and HogMaster Deluxe shows you how much memory has been used on screen (see Figure 3).
HogMaster Deluxe
Figure 3. HogMaster Deluxe
When you run HogMaster Deluxe, you will see a set of instructions for using the application. Here's how you control HogMaster Deluxe:
  • Using the Up button on a remote control (or Up key on the desktop keyboard) increases the size of the next image you are going to add, doubling it each time you press it to a maximum of 3000 × 3000 pixels.
  • The Down arrow remote control button (or Down key the desktop keyboard) decreases the size of the next image, dividing it in half each time you press it to a minimum of 1 × 1 pixel.
  • After you've adjusted the size of the image, press the Right arrow button/key. This adds a new hog image to a random location on the screen. The image moves, bouncing off the sides of the screen; pressing the Right button again adds a new moving image and stops the previous image. Only the last image placed on the screen moves.
  • Press the Left button/key to remove the image you just placed on the screen.
HogMaster Deluxe uses the corners of the screen to tell you what's going on in the application:
  • The top-left corner shows the size of the next image that will be added, reflecting any change caused by pressing the Up and Down buttons/keys
  • The bottom-left corner tells you the number of hogs currently displayed on the screen
  • The top-right corner shows the approximate memory used by AIR to display all of the hogs currently shown on the screen. The number is approximately equal to the number of pixels for each image multiplied by four, since there are four colors per pixel: A (alpha, or transparent), R (red), G (green), and B (blue). The reason it is approximate is that the number does not include the memory used to display the text field.
Download these sample application tools and source files at the top of this page. We hope you'll find these applications to be useful. Let us know what you think.
Special thanks to Adobe Digital Home engineering team members Don Woodward, who defined the sample application features, and John Simpson, who developed them.