Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Behavior 1: Seek to Cue

Behavior 1: Seek to Cue

The Seek to Cue behavior allows you to jump to a time saved in a cue point within the media component. The following instructions show you how to add this behavior to a custom button.

To use this behavior:

  1. Add a Media Playback component to the Stage.
  2. Select the component and open the Component Inspector panel.
  3. Enter the URL parameter with the path to the video and add a name and time to a cue point field.
  4. Add a button to the Stage and select it.
  5. Open the Behaviors panel and click the plus (+) icon to access the list of behavior categories. Select the Media Controls category and choose Seek to Cue from the list. The behavior’s dialog box opens (see Figure 1).

    figure 1

    Figure 1. The Seek to Cue dialog box shows the target MediaDisplay (myMediaControl1) selected and the target cue name (cue1) entered in the field below.

  6. In the dialog box, browse for the media playback instance in the target list in the top portion of the dialog box. This targets the instance name of the component displaying the video. A best practice is to use the Relative option for the path, as shown above. If you have problems adding paths to component buttons, try using the Absolute option instead.
  7. In the Add Cue Point Name field, enter the name of the cue point you saved in the Component Inspector panel.
  8. Click OK.

That’s it. Test the movie and click the button while the video is playing to see the video jump to the cuepoint time.

Here’s the code that is added to the button:

// Start Seek to Cue Behavior

var m = myMediaControl1;
var q = m.getCuePoint("cue1");
m.play(Math.round(q.time));

// End Seek to Cue Behavior

Tips:

  • In the code, the cue time is rounded to the nearest second to produce the smoothest results for tracking. You can alter this to target shorter time signatures.
  • When trying to seek to a timecode or event in an FLV, the playhead often jumps to the wrong time. This is because you can only seek to a whole keyframe within the video. If you try to seek to any other time, the playhead jumps to the nearest whole keyframe. The keyframe value is set at encode-time.

Comments