| Package | feathers.utils.touch |
| Class | public class TouchToState |
| Inheritance | TouchToState Object |
| Subclasses | DelayedDownTouchToState |
| Product Version : | Feathers 3.2.0 |
TouchPhase when the
target is touched. Conveniently handles all TouchEvent listeners
automatically. Useful for custom item renderers that should be change
state based on touch.
See also
| Property | Defined By | ||
|---|---|---|---|
| callback : Function
The function to call when the state is changed. | TouchToState | ||
| currentState : String [read-only]
The current state of the utility. | TouchToState | ||
| customHitTest : Function
In addition to a normal call to hitTest(), a custom
function may impose additional rules that determine if the target
should change state. | TouchToState | ||
| downState : String
The value for the "down" state. | TouchToState | ||
| hoverState : String
The value for the "hover" state. | TouchToState | ||
| isEnabled : Boolean
May be set to false to disable the state changes
temporarily until set back to true. | TouchToState | ||
| keepDownStateOnRollOut : Boolean
If true, the button state will remain as
downState until TouchPhase.ENDED. | TouchToState | ||
| target : DisplayObject
The target component that should change state based on touch phases. | TouchToState | ||
| upState : String
The value for the "up" state. | TouchToState | ||
| Method | Defined By | ||
|---|---|---|---|
TouchToState(target:DisplayObject = null, callback:Function = null)
Constructor. | TouchToState | ||
| callback | property |
callback:FunctionThe function to call when the state is changed.
The callback is expected to have the following signature:
function(currentState:String):void
public function get callback():Function public function set callback(value:Function):void| currentState | property |
currentState:String [read-only] The current state of the utility. May be different than the state of the target.
public function get currentState():String| customHitTest | property |
customHitTest:Function
In addition to a normal call to hitTest(), a custom
function may impose additional rules that determine if the target
should change state. Called on TouchPhase.BEGAN.
The function must have the following signature:
function(localPosition:Point):Boolean;
The function should return true if the target should
be triggered, and false if it should not be
triggered.
public function get customHitTest():Function public function set customHitTest(value:Function):void| downState | property |
downState:StringThe value for the "down" state.
The default value is feathers.controls.ButtonState.DOWN.
public function get downState():String public function set downState(value:String):void| hoverState | property |
hoverState:StringThe value for the "hover" state.
The default value is feathers.controls.ButtonState.HOVER.
public function get hoverState():String public function set hoverState(value:String):void| isEnabled | property |
isEnabled:Boolean
May be set to false to disable the state changes
temporarily until set back to true.
public function get isEnabled():Boolean public function set isEnabled(value:Boolean):void| keepDownStateOnRollOut | property |
keepDownStateOnRollOut:Boolean
If true, the button state will remain as
downState until TouchPhase.ENDED. If
false, and the touch leaves the bounds of the button
after TouchPhase.BEGAN, the button state will change to
upState.
The default value is false.
public function get keepDownStateOnRollOut():Boolean public function set keepDownStateOnRollOut(value:Boolean):void| target | property |
target:DisplayObjectThe target component that should change state based on touch phases.
public function get target():DisplayObject public function set target(value:DisplayObject):void| upState | property |
upState:StringThe value for the "up" state.
The default value is feathers.controls.ButtonState.UP.
public function get upState():String public function set upState(value:String):void| TouchToState | () | Constructor |
public function TouchToState(target:DisplayObject = null, callback:Function = null)Constructor.
Parameterstarget:DisplayObject (default = null) | |
callback:Function (default = null) |