13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with video<br />

Using image metadata<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

The onImageData ev<strong>en</strong>t s<strong>en</strong>ds image data as a byte array through an AMF0 data channel. The data can be in JPEG,<br />

PNG, or GIF formats. Define an onImageData() callback method to process this information, in the same way that<br />

you would define callback methods for onCuePoint and onMetaData. The following example accesses and displays<br />

image data using an onImageData() callback method:<br />

public function onImageData(imageData:Object):void<br />

{<br />

// display track number<br />

trace(imageData.trackid);<br />

var loader:Loader = new Loader();<br />

//imageData.data is a ByteArray object<br />

loader.loadBytes(imageData.data);<br />

addChild(loader);<br />

}<br />

Using text metadata<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

The onTextData ev<strong>en</strong>t s<strong>en</strong>ds text data through an AMF0 data channel. The text data is in UTF-8 format and contains<br />

additional information about formatting, based on the 3GP timed-text specification. This specification defines a<br />

standardized subtitle format. Define an onTextData() callback method to process this information, in the same way<br />

that you would define callback methods for onCuePoint or onMetaData. In the following example, the onTextData()<br />

method displays the track ID number and corresponding track text.<br />

public function onTextData(textData:Object):void<br />

{<br />

// display the track number<br />

trace(textData.trackid);<br />

// displays the text, which can be a null string, indicating old text<br />

// that should be erased<br />

trace(textData.text);<br />

}<br />

Monitoring NetStream activity<br />

Flash Player 10.3 and later, Adobe AIR 2.7 and later<br />

You can monitor NetStream activity to collect the information required to support media usage analysis and reporting.<br />

The monitoring features discussed in this section allow you to create media measurem<strong>en</strong>t libraries that collect data<br />

without close coupling to the particular video player displaying the media. This allows your cli<strong>en</strong>t developers to choose<br />

their favorite video players wh<strong>en</strong> using your library. Use the NetMonitor class to monitor the creation and activity of<br />

NetStream objects in an application. The NetMonitor class provides a list of the active NetStreams existing at any giv<strong>en</strong><br />

time and also dispatches an ev<strong>en</strong>t wh<strong>en</strong>ever a NetStream object is created.<br />

A NetStream object dispatches the ev<strong>en</strong>ts listed in the following table, dep<strong>en</strong>ding on the type of media being played:<br />

Last updated 6/6/2012<br />

501

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!