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, Method 2

You can also seek to a specified cue point in an FLV file by using the seekToCuePoint() method. Here is the procedure for this technique:

  1. Create a new Flash document called seek2.fla.
  2. Drag an instance of the FLVPlayback component from the Components panel (Window > Components).
  3. Select the component and open the Property inspector (Window > Properties > Properties).
  4. Type my_flvPb in the Instance Name text box.
  5. With the FLVPlayback instance still selected, click the Parameters tab.
  6. Type http://www.helpexamples.com/flash/video/cuepoints.flv in the contentPath text box (see Figure 8).
    Figure 8

    Figure 8 The path to the cuepoints.flv file on the Helpexamples server

    When you type the URL in the contentPath text box, the cue points appear in the Parameters tab (next to cuePoint parameter), as shown in Figure 9. Therefore, you can determine the name of the cue point that you want to find in your code. If you click the magnifying glass icon, you can view all the video file’s cue points and information about each cue point in a table.

    Figure 9

    Figure 9 The cue points as they appear in the Parameters tab

  7. Drag an instance of the Button component from the Components panel to the Stage.
  8. Select the Button component and type my_button in the Instance Name text box.
  9. Select Frame 1 on the Timeline and type the following code in the Actions panel (see Figure 10):
    import mx.video.FLVPlayback;
    var my_flvPb:FLVPlayback;
    my_flvPb.autoPlay = false;
    my_button.label = "Seek to point2";
    
    function clickMe(){
     my_flvPb.seekToNavCuePoint("point2");
    }
    my_button.addEventListener("click", clickMe);
  10. Select Control > Test Movie to test your code.
    Figure 10

    Figure 10 Carefully enter this script in the Actions pane.

    As related above, the cuepoints.flv file contains three navigation cue points. When you click the button, the FLVPlayback instance seeks to the specified cue point, in this case cue point, "point2".

  • + Share This
  • 🔖 Save To Your Account