Recipe 9.8. Building Menus with ButtonsProblemYou want to create menus such that you can press one button and then roll over and release on others. SolutionSet all the button instances to track as menu items. DiscussionThe normal behavior for buttons is such that if you press one button (but don't yet release) and then drag the mouse pointer over another button, the other button will not respond to the rollover event. And if you release on top of a button other than the one on which you first pressed, the release event will not be activated either. In many cases, this is the behavior that you want from your buttons. However, when working with buttons that compose menus, you may want to alter that behavior such that buttons in the menu respond to rollover and release events even if the user first pressed another button in the menu. This behavior is particularly important for pop-up menus in which the user has to press one button to expand the menu. You can quickly modify the behavior of a button in this way by setting it to track as a menu item. With button symbol instances, you can choose this option from the Property inspector. If you select the button instance on the stage, you can choose Track as Menu Item from the tracking menu. The preceding technique works for button symbol instances at authoring time. If you want to track movie clip symbols as menu items or if you want to perform the same task at runtime, you can use the trackAsMenu property. The TRackAsMenu property is a property for both button and movie clip instances, and can have a value of either true or false. By default the value is false, meaning that the instance is not tracked as a menu item. By setting the property to true, Flash immediately begins tracking the instance as a menu item. One of the advantages of using this technique is that you can switch back and forth between tracking an instance as a menu item or not. btInstance.trackAsMenu = true; |
Tripod >> 3pod Tips & Learning and manuals for educations