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 />

The following example uses a simple for..in loop to iterate over each of the properties in the infoObject parameter<br />

that the onCuePoint()function receives. It calls the trace() function to display a message wh<strong>en</strong> it receives cue point data:<br />

var nc:NetConnection = new NetConnection();<br />

nc.connect(null);<br />

var ns:NetStream = new NetStream(nc);<br />

ns.cli<strong>en</strong>t = this;<br />

ns.play("video.flv");<br />

var vid:Video = new Video();<br />

vid.attachNetStream(ns);<br />

addChild(vid);<br />

function onCuePoint(infoObject:Object):void<br />

{<br />

var key:String;<br />

for (key in infoObject)<br />

{<br />

trace(key + ": " + infoObject[key]);<br />

}<br />

}<br />

The following output appears:<br />

parameters:<br />

name: point1<br />

time: 0.418<br />

type: navigation<br />

This code uses one of several techniques to set the object on which the callback method runs. You can use other<br />

techniques; for more information, see “Writing callback methods for metadata and cue points” on page 486.<br />

Using video metadata<br />

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

You can use the OnMetaData() and OnXMPData() functions to access the metadata information in your video file,<br />

including cue points.<br />

Using OnMetaData()<br />

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

Metadata includes information about your video file, such as duration, width, height, and frame rate. The metadata<br />

information that is added to your video file dep<strong>en</strong>ds on the software you use to <strong>en</strong>code the video file.<br />

Last updated 6/6/2012<br />

492

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

Saved successfully!

Ooh no, something went wrong!