class BasicToggleButton
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IStateContext<ToggleButtonState>, IToggle, ITriggerView
extended by ToggleButton
A simple toggle button control with selection, pointer states, but no
content, that is useful for purposes like skinning. For a more full-featured
toggle button, with a label and icon, see feathers.controls.ToggleButton
instead.
Events:
openfl.events.Event.CHANGE | Dispatched when the
|
|---|---|
feathers.events.TriggerEvent.TRIGGER | Dispatched when the the user taps or clicks the button. The pointer must remain within the bounds of the button on release to register as a tap or a click. If focus management is enabled, the button may also be triggered by pressing the spacebar while the button has focus. |
1.0.0
.See also:
Constructor
Variables
backgroundSkin:DisplayObject
The default background skin for the toggle button, which is used when no
other skin is defined for the current state with setSkinForState().
The following example passes a bitmap for the button to use as a background skin:
button.backgroundSkin = new Bitmap(bitmapData);1.0.0
.See also:
read onlycurrentState:ToggleButtonState
The current state of the toggle button.
When the value of the currentState property changes, the button will
dispatch an event of type FeathersEvent.STATE_CHANGE.
1.0.0
.See also:
keepDownStateOnRollOut:Bool
Determines if a pressed button should remain in the down state if the
pointer moves outside of the button's bounds. Useful for controls like
HSlider, VSlider, or ToggleSwitch to keep a thumb in the down
state while it is being dragged around by the pointer.
The following example ensures that the button's down state remains active on roll out.
button.keepDownStateOnRollOut = true;1.0.0
.selected:Bool
Indicates if the button is selected or not. The button may be selected
programmatically, even if toggleable is false, but generally,
toggleable should be set to true to allow the user to select and
deselect it by triggering the button with a click or tap. If focus
management is enabled, and the button has focus, a button may also be
triggered with the spacebar.
When the value of the selected property changes, the button will
dispatch an event of type Event.CHANGE.
The following example selects the button:
button.selected = true;
The following example listens for changes to the selected property:
button.addEventListener(Event.CHANGE, (event:Event) -> {
trace("selected changed: " + button.selected)
});
Warning: Do not listen for TriggerEvent.TRIGGER to be notified
when the selected property changes. You must listen for
Event.CHANGE, which is dispatched after TriggerEvent.TRIGGER.
1.0.0
.See also:
selectedBackgroundSkin:DisplayObject
The default background skin for the toggle button when the selected
property is true. Takes precendence over backgroundSkin, but will
defer to another skin that is defined for the current state with
setSkinForState().
The following example gives the toggle button a default selected skin:
button.selectedBackgroundSkin = new Bitmap(bitmapData);1.0.0
.See also:
toggleable:Bool
Determines if the button may be selected or deselected as a result of
user interaction. If true, the value of the selected property will
be toggled when the button is triggered.
The following example disables the ability to toggle on click or tap:
button.toggleable = false;1.0.0
.See also:
Methods
getSkinForState(state:ToggleButtonState):DisplayObject
Gets the skin to be used by the toggle button when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, returns null.
1.0.0
.See also:
setSkinForState(state:ToggleButtonState, skin:DisplayObject):Void
Set the skin to be used by the toggle button when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, the value of the
backgroundSkin property will be used instead.
1.0.0
.See also: