8.
Select Frame 1 on the Timeline, and type the following code in the Actions panel:
var my_flvPb:mx.video.FLVPlayback;
my_flvPb.contentPath = "http://www.helpexamples.com/flash/video/
clouds.flv";
// Create cuePoint object.
var cuePt:Object = new Object();
cuePt.time = 1;
cuePt.name = "elapsed_time";
cuePt.type = "actionscript";
// Add AS cue point.
my_flvPb.addASCuePoint(cuePt);
// Add another AS cue point.
my_flvPb.addASCuePoint(2, "elapsed_time2");
// Display cue point information in text field.
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject) {
my_ta.text += "Elapsed time in seconds: " + my_flvPb.playheadTime +
"\n";
};
my_flvPb.addEventListener("cuePoint",listenerObject);
9.
Select Control > Test Movie to test your code.
The following cue points trace in the Output panel:
Elapsed time in seconds: 1.034
Elapsed time in seconds: 2.102
For information on
addASCuePoint()
For information on working with cue points and the FLVPlayback component, see
cue points" on page 498
on page
489.
The following example shows how to add cue points at runtime and then trace the cue points
when a FLV file plays in the MediaPlayback component.
To create and use cue points with the MediaPlayback component:
1.
Create a new Flash document called cuePointMP.fla
2.
Drag an instance of the MediaPlayback component from the Components panel (Window
> Components) to the Stage.
The component is in the Media - Player 6 - 7 folder.
3.
Select the component, and open the Property inspector (Window > Properties >
Properties).
4.
Type my_mp in the Instance Name text box.
616
Working with Images, Sound, and Video
, see
"FLVPlayback.addASCuePoint()" on page
and
"FLVPlayback Component (Flash Professional Only)"
535.
"Using
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?