Posts in Category "Tutorials"

New Flash Runtimes gaming blog: for neophytes (and willing mentors)

Are you new to game development? Struggling to find your footing in the ActionScript game development world? So am I. Although ActionScript and programming are not new to me, game development and gaming in general are. In my blog I’ll be exploring how to get a game going, what kinds of existing games are out there, cutting edge technologies, and how various technologies work together towards a great gaming experience.

Come along for the ride, and please share your experiences and insights! http://actionscriptandotherthings.wordpress.com/

Native extensions: When to call FREContext instance methods

Here’s a little tidbit about developing native extensions for Adobe AIR for Android devices using the native extension Java API.

The main point: The call that your extension’s ActionScript side makes to ExtensionContext.createExtensionContext()  must return before the native side of the extension can call methods of the instance of your class that extends the  FREContext class.

Let’s break that down.

The AIR runtime instantiates your FREExtension instance the first time the  ActionScript side of your extension calls ExtensionContext.createExtensionContext().

The sequence of calls to your Java implementation of the FREExtension class is:

  • FREExtension implementation class constructor
  • initialize()
  • createContext()

In createContext(), you return an instance of your class that extends the FREContext class.

But be careful. The FREContext object can only be considered fully constructed once the ExtensionContext.createExtensionContext() ActionScript method has returned.

Therefore, do not call any methods of your FREContext instance until after the ExtensionContext.createExtensionContext() ActionScript method has returned.

For example, you might be tempted to call your FREContext instance’s getActivity() method in its constructor. Don’t do it. You’ll get an IllegalStateException if you do.

Instead:

  • Provide an initialization method that the ActionScript side can call after ExtensionContext.createExtensionContext() returns.
  • In the initialization method, call your FREContext instance’s getActivity() method.

The Gyroscope and Vibration examples do exactly that. See them at http://www.adobe.com/devnet/air/native-extensions-for-air.html.

Detailed documentation about creating extensions is at Developing native extensions for Adobe AIR.

To use a native extension in your AIR application, see Using native extensions in AIR applications.

Pen tablet native extension example

Sean Fujiwara recently posted a native extension for Adobe AIR at AIR 3 Native Extension Example – PenTablet.

This extension lets an AIR application get the pressure sensitivity data from a Wacom Intuos 4 pen tablet on Windows 7.  It’s a good example of a Windows native extension that handles Windows messages and uses a native library — in this case, the pen tablet’s library.

Sean also provided another native extension for Windows that encodes a bitmap into BMP, JPEG, or PNG format using Microsoft .NET Framework 4.  See  AIR 3 Native Extension Example – ImageProcessor.

You can see more examples and tutorials of native extensions at the Adobe Developer Connection page http://www.adobe.com/devnet/air/native-extensions-for-air.html

Detailed documentation about creating extensions is at Developing native extensions for Adobe AIR.

To use a native extension in your AIR application, see Using native extensions in AIR applications.

Putting the “Community” in community content

Over the past year we’ve been out in the community listening to issues and gathering content. The results of our labors have been  links and code samples added to our help pages. While we feel this makes our content more dynamic, it doesn’t do much unless you know it there. So, in an effort to get  more eyes on all this great community content, we’re spicing up our pages in a couple of ways:

In the spirit of giving credit where credit is due, here’s a list of some of authors we’ve highlighted so far:
If you have a great tutorials, videos or code sample you want to share, send it along. We’d love to add it to our content so everyone can benefit from your expertise.

Video: Install Flash Media Server 4.5 and stream content to Flash and iOS

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.

 

     

    Check out this great AIR for Android article

    The August edition of the Adobe Edge newsletter features a great article by ace Flash/Flex/ColdFusion developer Brian Rinaldi. It’s called Getting Started with Adobe AIR for Android.  Here’s a quick excerpt from the piece that describes what it covers:

    “In this article, I discuss the essential tools you need to start developing for AIR for Android using Adobe Flash Professional CS5. I walk you through getting AIR installed on your Android phone and configuring Flash software to develop for that platform. Then I show you how to build and deploy your first application.”

    While we’re on the topic of Brian, the Flash Platform content and community team are very pleased to announce that Brian joined our team as Web Community Manager as of August 16. Brian will be working with Adobe to define and drive our community strategy and develop programs to promote community help.

    Many of you may know Brian as an author, presenter and thought-leader within the Adobe developer community. He has more than 11 years of experience developing web applications in both small businesses and large enterprises including 10+ years with ColdFusion and SQL (he is an Adobe Certified Expert in ColdFusion) and 3+ years with Flex/AIR/ActionScript.

    Brian has been an active organizer and volunteer for several years. He started  his own conference in Boston – known first as Flex Camp Boston, now as RIA Unleashed. In addition to running the Boston ColdFusion User Group for the past five years, Brian was an Adobe Community Professional as well as an advisor to the Boston Flex User Group.

    Brian blogs regularly at remotesynthesis.com and is an unapologetic Twitter addict under the handle @remotesynth. Check him out!

    Test your Flash Platform Android apps now, without a phone

    Writing Flash Platform applications for Android, or designing Flash content for mobile users and want to see the content emulated on specific mobile devices? Adobe Device Central CS5 has profiles for many mobile devices so you can test your applications without owning the device.

    Since Adobe just released the official Motorola Droid X profile for Android, you can test your Android 2.2 (aka “Froyo”) apps and sites now and get the phone later.

    To test apps In Flash Professional CS5

    With your FLA file open, select Control > Test Movie > in Device Central. Select the device you want in the Test Devices panel. The application appears in the emulator:

    emulateX.gif

    To get new devices

    In Device Central, click Browse and then search for a keyword, like “Droid” to see what’s available:

    browseprofiles.gif

    Click and drag new profiles, like the Motorola Droid or Motorola Droid X, to your list of Test Devices.

    If you don’t see the profile you want, come back soon; the community is posting new profiles daily and Adobe posts official profiles as they are finalized.

    To get back to the list of devices at any time

    Click Browse and the Home button:

    homeprofiles.gif

    Click Emulate Flash to get back to testing in the emulator

    To test mobile-specific features, like the Accelerometer

    If a phone’s profile supports accelerometer or other mobile features, you can test them in Device Central. The Accelerometer panel lets you simulate moving the device in three
    dimensions. Alt+Click simulates multiple finger touches and the Multitouch panel lets you set touch size and pressure. The Geolocation panel lets you test GPS features, and other panels
    provide even more information:

    devicefeature.gif

    Device Central works with Dreamweaver and several other Adobe products. Test your entire Flash-enabled Web site for mobile browsing using Device Central (including HTML5 sites).

    Related links:

    Sweet video description of organizing classes, implementing mobile feature APIs and using Device Central by Adobe’s Mark Doherty: http://www.flashmobileblog.com/2010/04/14/device-central-cs5-multitouch-and-debugger/

    Device Central Support page: http://www.adobe.com/support/devicecentral/

    Twitter updates for Device Central profiles: http://twitter.com/devicecentral

    Dreamweaver HTML5 Pack extension: http://labs.adobe.com/downloads/html5pack.html

    Dreamwever testing mobile content in Device Central Adobe TV page: http://tv.adobe.com/watch/learn-dreamweaver-cs5/testing-mobile-content-with-adobe-device-central/

    Using Device Anywhere (an alternative to Device Central) for testing: http://www.adobe.com/devnet/devices/articles/device_anywhere.html

    Tutorial: HTTP Dynamic Streaming

    Until now, there have been two fundamental ways to deliver video to Flash Player/AIR:

    • Progressive download. Progressive download transfers files sequentially over HTTP from a web server to Flash Player/AIR. Users can’t skip ahead until all the previous content has downloaded.
    • RTMP streaming. RTMP streaming transfers content between Flash Player/AIR and Flash Media Server in real-time (Real-Time Media Protocol). Users can skip to any location without waiting.

    Now there’s a third way to deliver content to Flash Player 10.1 and AIR 2:

    • HTTP Dynamic Streaming. HTTP Dynamic Streaming delivers content over HTTP and lets users skip to any location without waiting.

    To stream on-demand (recorded, not live) content over HTTP, you can use any installation of Apache 2.2, including the version that installs with Flash Media Server 3.5. Using Adobe HTTP Dynamic Streaming has an end-to-end tutorial that steps you through configuring Apache, packaging content for delivery, and playing the content in the OSMF Player.

    Using Adobe HTTP Dynamic Streaming also contains a live tutorial, and detailed information about how this new solution works. To stream live content over HTTP, you need Flash Media Server 3.8.

    For more information about the HTTP Dynamic Streaming ecosystem, see Kevin Towes’ blog and www.adobe.com/products/httpdynamicstreaming.