Recipe 14.3. Creating a Jump Menu


Problem

You want to create a jump menua menu that causes some action to take place as soon as the user makes a selection.

Solution

Use a combo box or a list in conjunction with a listener object.

Discussion

The 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 Also

Recipe 14.1, Recipe 13.12




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net