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 4: Set Video Stream

Behavior 4: Set Video Stream

The Set Video Stream behavior allows you to enter the path to the video to be displayed. 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. Add a button to the Stage and select it.
  3. Open the Behaviors panel and click the plus (+) icon to access the list of behavior categories. Select the Media Controls category and choose Set Video Stream from the list. The behavior’s dialog box opens (see Figure 4).

    figure 4

    Figure 4. The Set Video Stream dialog box shows the target MediaDisplay (myMediaControl4) selected. The path to the FLV video source is entered in the field below.

  4. Browse for the media playback instance in the target list in the bottom 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.
  5. Enter the path to the FLV video file.
  6. Set the Autoplay video option to True or False.
  7. Click OK.

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

// Start Set Video Stream Behavior
var m = myMediaControl4;
var p = true;
m.setMedia("myMovie.flv");
if (p)
  n.play();
else
  n.stop();
// End Set Video Stream Behavior

Tip:

  • At the time I wrote this article, there is a known issue with the setMedia function when loading the same FLV file repetitively. If a button containing this behavior is clicked in repetition to call the same video file, the video may not appear on some clicks. Loading different FLV files each time works without error, however.

Comments