Posts in Category "ActionScript"

Native extensions in AIR 3

The Adobe AIR 3 Release Candidate is available, and includes this new feature: Native extensions for Adobe AIR.

Until now, native extensions were available on AIR for TV, but not for AIR on desktop or mobile devices. Now you can create an ActionScript library that can execute native code on all these devices. This means an AIR application developer, using ActionScript, can take advantage of platform-specific and device-specific native capabilities.

We’ll blog here about documentation and examples as they become available. In the meantime, you can read more about it in this Adobe Developer Connection article:  Extending Adobe AIR.

And get the AIR 3 Release Candidate download to get started.

 

 

 

 

Adobe Cookbook recipe challenge begins!

Got a tasty tip or technique to offer to the Flash Platform developer community? Want a shot at winning a Samsung 10.1 tablet? If so, head on over to the Adobe Developer Center and learn more about the Adobe Cookbook recipe request challenge: http://adobe.ly/ot8Eoy. Everyone who responds to the challenge by contributing a cookbook recipe gets an Adobe Developer Connection T-shirt, plus a chance to win the tablet. Good luck!

Develop AIR for TV apps for Samsung Smart TVs

You can now develop AIR 2.5.1  for TV apps for Samsung Smart TVs.

Register at  the Samsung D Forum to learn how to package AIR apps for Samsung Smart TVs.

Read this document:  AIR for TV Application Guide for Samsung TVs.  You will  need to login to the  Samsung D Forum to read the document, but you can quickly get a login id by following the instructions on the Samsung D Forum page.

You can learn more general information for developing AIR for TV apps at Developing AIR applications for television devices.

More information like samples,  tutorials, and articles are at Flash Platform for TV.

Vector.sort() documentation update

A community member  pointed out recently that the ActionScript Language Reference description for Vector.sort() is incomplete. The reference will be updated soon. In the meantime, here’s the corrected description, which now includes sorting according to a “sort option” as well as sorting by using a compare function.

Vector sort() method:

Sorts the elements in the Vector object, and also returns a sorted Vector object. This method sorts according to the parameter sortBehavior, which is either a function that compares two values, or a set of sorting options.

The method takes one parameter. The parameter is one of the following:

  • a function that takes two arguments of the base type (T) of the Vector and returns a Number:

function compare(x:T, y:T):Number {}

The logic of the function is that, given two elements x and y, the function returns one of the following three values:

  • a negative number, if x should appear before y in the sorted sequence
  • 0, if x equals y
  • a positive number, if x should appear after y in the sorted sequence
  • a number which is a bitwise OR of the following values:
  • 1 or Array.CASEINSENSITIVE
  • 2 or Array.DESCENDING
  • 4 or Array.UNIQUESORT
  • 8 or Array.RETURNINDEXEDARRAY
  • 16 or Array.NUMERIC

If the value is 0, the sort works in the following way:

  • Sorting is case-sensitive (Z precedes a).
  • Sorting is ascending (a precedes b).
  • The array is modified to reflect the sort order; multiple elements that have identical sort fields are placed consecutively in the sorted array in no particular order.
  • All elements, regardless of data type, are sorted as if they were strings, so 100 precedes 99, because “1″ is a lower string value than “9″.

Parameters
sortBehavior:* — A Function or a Number value that determines the behavior of the sort. A Function parameter specifies a comparison method. A Number value specifies the sorting options.

Returns
Vector  — A Vector object, with elements in the new order.

AIR for TV application documentation updates

Updates are now available to Developing AIR applications for television devices in Building Adobe AIR Applications on Adobe.com.

These updates include:

  • Design considerations. Remember all the entries on this blog that talked about various design considerations for AIR for TV apps? Now those tips plus others are available in the online documentation.
  • How to use Adobe Flash Professional CS5 and Adobe Flash Builder 4.5 to develop your AIR for TV application. This information includes how to build an application that uses an ActionScript extension.
  • How to use ADT to package an AIR for TV application that uses an ActionScript extension.
  • How to use ADL to test an AIR for TV application that uses an ActionScript extension.
  • General information on how to remotely debug an AIR for TV application running on the device. However, detailed steps depend on the device.

Beta ActionScript 3.0 Reference documentation available for Flash Player 10.3 Beta

The prerelease ActionScript 3.0 Reference for Flash Player 10.3 (“Wasabi”) Beta is now available. You can find this documentation here.

The Wasabi project represents the convergence of Flash Player and AIR streams into a single quarterly update.

Highlights include the following new features and classes:

Acoustic echo cancellation (Flash Player)
Exclude unwanted echo artifacts from microphone audio captures.

Media measurement (Flash Player)
Implement media usage analysis on the Flash Player platform rather than as a player plugin. Collect stats independently of the video player being used.

HTMLLoader updates (AIR)
The HTMLLoader class now dispatches locationChanging and locationChange events with a LocationChangeEvent object as the payload.

Important! To see the beta classes, remember to set your Runtimes filter to include Flash Player 10.3 and earlier.

Please use the Comments area at the bottom of each page to give us feedback on this beta documentation.

Managing graphics memory in AIR for TV apps

And here’s one more design consideration for AIR for TV application development…

This one continues the discussion from the blog entry called Using Graphics Hardware Acceleration in AIR for TV Apps.

To perform the accelerated graphics operations, hardware accelerators use special graphics memory. If your
application uses all the graphics memory, the application runs more slowly because AIR for TV reverts to using
software for the graphics operations.

To manage your application’s use of graphics memory:

  • When you are done using an image or other bitmap data, release its associated graphics memory. To do so, call the dispose() method of the bitmapData property of the Bitmap object. For example:

myBitmap.bitmapData.dispose();

Note: Releasing the reference to the BitmapData object does not immediately free the graphics memory. The runtime’s garbage collector eventually frees the graphics memory, but calling dispose() gives your application more control.

  • Use PerfMaster Deluxe, an AIR application that Adobe provides, to better understand the impact of hardware graphics acceleration on your target device. This application shows the frames per second to execute various operations. Use PerfMaster Deluxe to compare different implementations of the same operation.  For example, compare moving a bitmap image versus moving a vector image. PerfMaster Deluxe is available with the Adobe® AIR® for TV MAX 2010 Hardware Developer Kit, and will soon be available at Flash Platform so you can use it with other devices, too.

And don’t forget: Do not keep bitmap objects, or any objects, on the display list when they are not visible. Whether software or hardware renders a display object, rendering it when it is not visible needlessly uses resources to render the object. If you have a good reason to hold onto a display object when it is not visible, remove the object from the display list. This best practice applies not only for AIR for TV apps, but AIR apps and Flash Player apps on all devices (mobile, desktop, tablet, and TVs).

UI personality for AIR for TV applications

Here’s another user interface design consideration for AIR for TV applications. (This and other tips will be incorporated soon into Adobe online documentation).

This tip considers that users of AIR for TV applications are typically seeking TV quality entertainment in a fun and relaxed environment. They are not necessarily knowledgeable about computers or technology.

Therefore, design AIR for TV applications with the following characteristics:

  • Do not use technical terms.
  •  

  • Avoid modal dialogs.  Modal dialogs confuse some users.
  •  

  • Use friendly, informal instructions appropriate for a living room environment, not a work or technical environment.
  •  

  • Use graphics that have the high production quality that TV watchers expect.

 

     

    Usability of your AIR for TV application

    Here’s another design consideration for the user interface of AIR for TV applications. (This and other tips will be incorporated soon into Adobe online documentation).

    Users of AIR for TV applications are in a “living room” environment. They are sitting across the room from the TV, some 10 feet away. The room is sometimes dark. They typically use a remote control device for input. More than one person can be using the application, sometimes together, sometimes serially.

    Therefore, to design your user interface for usability on a TV, consider the following:

    • Make the user interface elements large.This best practice might be obvious to many developers, but the temptation does exist to crowd the screen just because the screen has so much space.  Don’t give in to this temptation. When designing text, buttons, or any other user interface elements, consider that the user is sitting across the room. Make everything easy to see and read from, for example, 10 feet away. 
    • Use good contrast to make the content easy to see and read from across the room.
    •  

    • Make obvious which user interface element has the focus by making that element bright.  See the blog entry from March 8 about Managing Focus.
    •  

    • Use motion only as necessary. For example, sliding from one screen to the next for continuity can work well. However, motion can be distracting if it does not help the user navigate or if it is not intrinsic to the application.
    •  

    • Always provide an obvious way for the user to go back through the user interface.

    Using graphics hardware acceleration in AIR for TV apps

    And here is yet one more tip from soon-to-be-available-at-adobe.com documentation about AIR for TV application development.

    AIR for TV devices provide hardware acceleration for 2D graphics operations. The device’s hardware graphics accelerators off-load the CPU to perform the following operations:

    • Bitmap rendering
    • Bitmap scaling
    • Bitmap blending
    • Solid rectangle filling

    This hardware graphics acceleration means many graphics operations in an AIR for TV application can be high performing. Some of these operations include:

    • Sliding transitions
    • Scaling transitions
    • Fading in and out
    • Compositing multiple images with alpha

    To get the performance benefits of hardware graphics acceleration for these types of operations, use one of the following techniques:

    • Set the cacheAsBitmap property to true on MovieClip objects and other display objects that have content that is mostly unchanging. Then perform sliding transitions, fading transitions, and alpha blending on these objects.
    • Use the cacheAsBitmapMatrix property on display objects you want to scale or translate (apply x and y repositioning).

      By using Matrix class operations for scaling and translation, the device’s hardware accelerators perform the operations. Alternatively, consider the scenario where you change the dimensions of a display object that has its cacheAsBitmap property set to true. When the dimensions change, the runtime’s software redraws the bitmap. Redrawing with software yields poorer performance than scaling with hardware acceleration by using a Matrix operation.

      For example, consider an application that displays an image that expands when an end user selects it. Use the Matrix scale operation multiple times to give the illusion of the image expanding. However, depending on the size of the original image and final image, the quality of the final image can be unacceptable. Therefore, reset the dimensions of the display object after the expanding operations are completed. Because cacheAsBitmap is true, the runtime software redraws the display object, but only once, and it renders a high-quality image.

      Note: Typically, AIR for TV devices do not support hardware-accelerated rotation and skewing. Therefore, if you specify rotation and skewing in the Matrix class, AIR for TV performs all the Matrix operations in the software. These software operations can have a detrimental impact to performance.
    • Use the BitmapData class to create custom bitmap caching behavior.