616
Working with Images, Sound, and Video
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.playhe
"\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()
, see
“FLVPlayback.addASCuePoint()” on page 535
.
For information on working with cue points and the FLVPlayback component, see
“Using
cue points” on page 498
and
“FLVPlayback Component (Flash Professional Only)”
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.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...