Behavior 5: Toggle AutoSize
September 11, 2006 | 0 comments
Behavior 5: Toggle AutoSize
The Toggle AutoSize behavior allows you to add code to a button so that it toggles the component’s autosize property between True and False. 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 Toggle AutoSize from the list. The behavior’s dialog opens (see Figure 5).
- 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.
- Click OK.
Here’s the code that is added to the button:
// Start Toggle AutoSize Behavior
var m = myMediaControl5
m.autoSize = !(m.autoSize);
// End Toggle AutoSize Behavior
Tip:
- To achieve the best results with the Toggle AutoSize effect, the MediaDisplay should be larger than the video, as seen in the sample FLA file.
Comments