ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > Button > trackAsMenu (Button.trackAsMenu property) | |||
public trackAsMenu : Boolean
A Boolean value that indicates whether other buttons or movie clips can receive mouse release events. If you drag a button and then release on a second button, the onRelease event is registered for the second button. This allows you to create menus. You can set the trackAsMenu property on any button or movie clip object. If the trackAsMenu property has not been defined, the default behavior is false.
You can change the trackAsMenu property at any time; the modified button immediately takes on the new behavior.
Availability: ActionScript 1.0; Flash Player 6
The following example demonstrates how to track two buttons as a menu. Place two button instances on the Stage called one_btn and two_btn. Enter the following ActionScript in the Timeline:
var one_btn:Button;
var two_btn:Button;
one_btn.trackAsMenu = true;
two_btn.trackAsMenu = true
one_btn.onRelease = function() {
trace("clicked one_btn");
};
two_btn.onRelease = function() {
trace("clicked two_btn");
};
Test the SWF file by clicking the Stage over one_btn, holding the mouse button down and releasing it over two_btn. Then try commenting out the two lines of ActionScript that contain trackAsMenu and test the SWF file again to see the difference in button behavior.
trackAsMenu (MovieClip.trackAsMenu property)
|
|
|
|