Recipe 14.3. Creating a Jump MenuProblemYou want to create a jump menua menu that causes some action to take place as soon as the user makes a selection. SolutionUse a combo box or a list in conjunction with a listener object. DiscussionThe combo box and list components dispatch change events when the user makes a selection. Therefore, if you use a listener object to handle those events, you can have Flash perform some tasks as soon as the user chooses an item from the combo box or list. This type of functionality is often referred to as a jump menu. In the following example, a listener object is registered with a combo box named ccbProducts. When the user makes a selection from the combo box, the value is displayed in the Output panel. var oListener:Object = new Object(); oListener.change = function(oEvent:Object):Void { trace(oEvent.target.value); }; ccbProducts.addEventListener("change", oListener); For more information regarding using listener objects, see Recipe 14.1. See AlsoRecipe 14.1, Recipe 13.12 |
Tripod >> 3pod Tips & Learning and manuals for educations