Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This
From the author of

Adding Seek Functionality Using Cue Points

To give you some idea of how cue points can be used in your Flash Video projects, let me demonstrate how to use them to add seek functionality to a playback interface.

The seekToNavCuePoint() method of the FLVPlayback component locates the cue point in the FLV file with the specified name, at or after the specified time. You can specify a name as a string (such as "part1" or "theWedding").

You can also use the seekToNextNavCuePoint() method, which seeks to the next navigation cue point, based on the current playheadTime. You can pass the method a parameter, time, which is the starting time from where to look for the next navigation cue point. The default value is the current playheadTime.

A third option is to seek to a specified duration of the FLV file by using the seek() method.

Here is a demonstration of how to seek to a specified cue point:

  1. Create a new Flash document called seek1.fla.
  2. Drag an instance of the FLVPlayback component from the Components panel (Window > Components).

    The component is in the FLVPlayback - Player 8 folder.

  3. Select the component and open the Property inspector (Window > Properties > Properties).
  4. Type my_flvPb in the Instance Name text box.
  5. Drag an instance of the Button component from the Components panel to the Stage.
  6. Select the Button component and type my_button in the Instance Name text box (see Figure 6).
    Figure 6

    Figure 6 The Flash Stage as it should appear at the end of step 6.

  7. Select Frame 1 on the Timeline and type the following code in the Actions pane (see Figure 7):
    import mx.video.FLVPlayback;
    var my_flvPb:FLVPlayback;
    my_flvPb.autoPlay = false;
    my_flvPb.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv";
    my_button.label = "Next cue point";
    
    function clickMe(){
     my_flvPb.seekToNextNavCuePoint();
    }
    my_button.addEventListener("click", clickMe);
    Figure 7

    Figure 7 Carefully enter this code into the Actions pane.

  8. Select Control > Test Movie to test your code.

    The line of code my_flvPb.contentPath = browses to a video clip, cuepoints.flv, located on the Adobe Help Examples server and loads it into the FLVPlayback component. This cuepoints.flv file contains three navigation cue points: one each near the beginning, middle, and end of the video clip. When you click the button, the FLVPlayback instance seeks to the next cue point until it reaches the last cue point in the video file.

  • + Share This
  • 🔖 Save To Your Account