Changes a target's state based on pointer events (MouseEvent and TouchEvent), like a button.

Available since

1.0.0

.

See:

feathers.utils.KeyToState

Constructor

@:value({ callback : null, target : null })new (?target:InteractiveObject, ?callback:String ‑> Void)

Variables

@:value(ButtonState.UP)read onlycurrentState:String = ButtonState.UP

The current state of the utility. May be different than the state of the target.

Available since

1.0.0

.

@:value(ButtonState.DOWN)downState:String = ButtonState.DOWN

The value for the "down" state.

Available since

1.0.0

.

@:value(true)enabled:Bool = true

May be set to false to disable the state changes temporarily until set back to true.

Available since

1.0.0

.

@:value(ButtonState.HOVER)hoverState:String = ButtonState.HOVER

The value for the "hover" state.

Available since

1.0.0

.

@:value(false)keepDownStateOnRollOut:Bool = false

If true, the current state will remain as downState until MouseEvent.MOUSE_UP is dispatched. If false, and the pointer leaves the bounds of the target after MouseEvent.MOUSE_DOWN, the current state will change to upState.

Available since

1.0.0

.

@:value(null)target:InteractiveObject = null

The target component that should change state based on pointer (mouse or touch) events.

Available since

1.0.0

.

@:value(ButtonState.UP)upState:String = ButtonState.UP

The value for the "up" state.

@:value(null)callback:String ‑> Void = null

The function to call when the state is changed.

The callback is expected to have the following signature:

String -> Void
Available since

1.0.0

.