Recipe 13.8. Adding a Button that Can Toggle


Problem

You want to add a button that the user can toggle to a selected or deselected state.

Solution

Add a Button component instance and set the toggle parameter to true.

Discussion

More often than not, buttons are used to trigger some action or actions. In such cases, a button like the one described in Recipe 13.7 is quite suitable. However, sometimes you want to use a button that can toggle between a selected and a deselected state. Such a button provides similar functionality to that of a checkbox, but with a slightly different interface.

It's actually quite simple to add a button that can be toggled to your Flash application. All you need to do is follow the directions for adding a Button component instance that are given in Recipe 13.7, and then set the toggle parameter to true rather than the default value of false. By default, the button will be deselected when the application starts. However, you can specify that it should default to the selected state by setting the selected parameter to true.

See Also

Recipe 13.7




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