EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 616

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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.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(), 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.

Table of Contents

Related product manuals