Using cue points

A cue point is a point at which the video player dispatches a cuePoint event while an FLV file plays. You can add cue points to an FLV file at times that you want to interact with another element on the web page. You might want to display text or a graphic, for example, or synchronize with a Flash animation or affect the playing of the FLV file by pausing it, seeking to a different point in time, or switching to a different FLV file. Cue points let you receive control in your ActionScript code and synchronize those points in your FLV file with other actions on the web page.

There are three types of cue points: navigation, event, and ActionScript. The navigation and event cue points are also known as embedded cue points because they are embedded in the FLV file stream and in the FLV file's metadata packet.

A navigation cue point allows you to seek to a particular frame in the FLV file because it creates a keyframe within the FLV file as near as possible to the time that you specify. A keyframe is a data segment that occurs between image frames in the FLV file stream. When you seek to a navigation cue point, the component seeks to the keyframe and starts the cuePoint event.

An event cue point enables you to synchronize a point in time within the FLV file with an external event on the web page. The cuePoint event occurs precisely at the specified time. You can embed navigation and event cue points in an FLV file using either the Video Import wizard or the Flash Video encoder. For more information on the Video Import wizard and the Flash Video encoder, see "Working with Video" in Using Flash.

An ActionScript cue point is an external cue point that you can add either through the component's Flash Video Cue Points dialog box or through the FLVPlayback.addASCuePoint() method. The component stores and tracks ActionScript cue points apart from the FLV file, and consequently, they are less accurate than embedded cue points. ActionScript cue points are accurate to a tenth of a second. You can increase the accuracy of ActionScript cue points by lowering the value of the playheadUpdateInterval property because the component generates the cuePoint event for ActionScript cue points when the playhead updates. For more information, see FLVPlayback.playheadUpdateInterval.

In ActionScript and within the FLV file's metadata, a cue point is represented as an object with the following properties: name, time, type, and parameters. The name property is a string that contains the assigned name of the cue point. The time property is a number representing the time in hours, minutes, seconds, and milliseconds (HH:MM:SS.mmm) when the cue point occurs. The type property is a string whose value is "navigation", "event", or "actionscript", depending on the type of cue point that you created. The parameters property is an array of specified name-and-value pairs.

When a cuePoint event occurs, the cue point object is available in the event object through the info property. For more information, see Listening for cuePoint events.

Related Topics


Flash CS3