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

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This
From the author of

Using Cue Points to Seek to a Specified Duration of a Video Clip

  1. Create a new Flash document called seekduration.fla.
  2. Drag an instance of the FLVPlayback component from the Components panel (Window > Components).
  3. The component is in the FLVPlayback - Player 8 folder.
  4. Select the component and open the Property inspector (Window > Properties > Properties).
  5. Type my_flvPb in the Instance Name text box.
  6. Drag an instance of the Button component from the Components panel to the Stage.
  7. Select the Button component and type seek_button in the Instance Name text box.
  8. Select Frame 1 on the Timeline and type the following code in the Actions panel (see Figure 11).
    import mx.controls.Button;
    import mx.video.FLVPlayback;
    var seek_button:Button;
    var my_flvPb:FLVPlayback;
    my_flvPb.autoPlay = false;
    my_flvPb.contentPath = "http://www.helpexamples.com/flash/video/sheep.flv";
    seek_button.label = "Seek";
    seek_button.addEventListener("click", seekFlv);
    function seekFlv(eventObj:Object):Void {
      // seek to 2 seconds 
      my_flvPb.seek(2);
    }
  9. Select Control > Test Movie to test your code.

    When you click the button, the video playhead moves to the duration that you specify; in this case, two seconds into the video (see Figure 11).

    Figure 11

    Figure 11 The linked movie playing in the SWF file. The Seek button has been pressed once and the video clip has skipped forward to the specified seek duration.

  • + Share This
  • 🔖 Save To Your Account