Package | feathers.utils.touch |
Class | public class TapToSelect |
Inheritance | TapToSelect Object |
Product Version : | Feathers 2.3.0 |
isSelected
property of the target when the
target is tapped (which will dispatch Event.CHANGE
).
Conveniently handles all TouchEvent
listeners automatically.
Useful for custom item renderers that should be selected when tapped.
In the following example, a custom item renderer will be selected when tapped:
public class CustomItemRenderer extends LayoutGroupListItemRenderer { public function CustomItemRenderer() { super(); this._tapToSelect = new TapToSelect(this); } private var _tapToSelect:TapToSelect; }
Note: When combined with a TapToTrigger
instance, the
TapToSelect
instance should be created second because
Event.TRIGGERED
should be dispatched before
Event.CHANGE
.
See also
Property | Defined By | ||
---|---|---|---|
customHitTest : Function
In addition to a normal call to hitTest(), a custom
function may impose additional rules that determine if the target
should be selected. | TapToSelect | ||
isEnabled : Boolean
May be set to false to disable selection temporarily
until set back to true. | TapToSelect | ||
tapToDeselect : Boolean
May be set to true to allow the target to be deselected
when tapped. | TapToSelect | ||
target : IToggle
The target component that should be selected when tapped. | TapToSelect |
Method | Defined By | ||
---|---|---|---|
TapToSelect(target:IToggle = null)
Constructor. | TapToSelect |
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 be selected. 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 selected, and false
if it should not be selected.
public function get customHitTest():Function
public function set customHitTest(value:Function):void
isEnabled | property |
isEnabled:Boolean
May be set to false
to disable selection temporarily
until set back to true
.
public function get isEnabled():Boolean
public function set isEnabled(value:Boolean):void
tapToDeselect | property |
tapToDeselect:Boolean
May be set to true
to allow the target to be deselected
when tapped.
public function get tapToDeselect():Boolean
public function set tapToDeselect(value:Boolean):void
target | property |
target:IToggle
The target component that should be selected when tapped.
public function get target():IToggle
public function set target(value:IToggle):void
TapToSelect | () | Constructor |
public function TapToSelect(target:IToggle = null)
Constructor.
Parameterstarget:IToggle (default = null )
|