Behavior 4: Set Video Stream
September 11, 2006 | 0 comments
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:
- Add a Media Playback component to the Stage.
- Add a button to the Stage and select it.
-
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).
- 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.
- Enter the path to the FLV video file.
- Set the Autoplay video option to True or False.
- 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