| Package | feathers.utils.touch |
| Class | public class LongPress |
| Inheritance | LongPress Object |
| Product Version : | Feathers 2.3.0 |
FeathersEventType.LONG_PRESS from the target when
the target is long-pressed. Conveniently handles all
TouchEvent listeners automatically. Useful for custom item
renderers that should dispatch a long press event.
In the following example, a custom item renderer will dispatch a long press event when tapped:
public class CustomItemRenderer extends LayoutGroupListItemRenderer
{
public function CustomItemRenderer()
{
super();
this._longPress = new LongPress(this);
}
private var _longPress:LongPress;
}Note: When combined with TapToSelect or
TapToTrigger, the LongPress instance should be
created first because it needs a higher priority for the
TouchEvent.TOUCH event so that it can disable the other
events.
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 long pressed. | LongPress | ||
| isEnabled : Boolean
May be set to false to disable the triggered event
temporarily until set back to true. | LongPress | ||
| longPressDuration : Number
The duration, in seconds, of a long press. | LongPress | ||
| tapToSelect : TapToSelect
If the target can be selected by tapping, the
TapToSelect instance should be passed in so that it can
be temporarily disabled when a long press is detected. | LongPress | ||
| tapToTrigger : TapToTrigger
If the target can be triggered by tapping, the
TapToTrigger instance should be passed in so that it can
be temporarily disabled when a long press is detected. | LongPress | ||
| target : DisplayObject
The target component that should dispatch
FeathersEventType.LONG_PRESS when tapped. | LongPress | ||
| Method | Defined By | ||
|---|---|---|---|
LongPress(target:DisplayObject = null)
Constructor. | LongPress | ||
| 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 long pressed. 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 long pressed, and false if it should not be
long pressed.
public function get customHitTest():Function public function set customHitTest(value:Function):void| isEnabled | property |
isEnabled:Boolean
May be set to false to disable the triggered event
temporarily until set back to true.
public function get isEnabled():Boolean public function set isEnabled(value:Boolean):void| longPressDuration | property |
longPressDuration:NumberThe duration, in seconds, of a long press.
The following example changes the long press duration to one full second:
longPress.longPressDuration = 1.0;
The default value is 0.5.
public function get longPressDuration():Number public function set longPressDuration(value:Number):void| tapToSelect | property |
tapToSelect:TapToSelect
If the target can be selected by tapping, the
TapToSelect instance should be passed in so that it can
be temporarily disabled when a long press is detected.
public function get tapToSelect():TapToSelect public function set tapToSelect(value:TapToSelect):void| tapToTrigger | property |
tapToTrigger:TapToTrigger
If the target can be triggered by tapping, the
TapToTrigger instance should be passed in so that it can
be temporarily disabled when a long press is detected.
public function get tapToTrigger():TapToTrigger public function set tapToTrigger(value:TapToTrigger):void| target | property |
target:DisplayObject
The target component that should dispatch
FeathersEventType.LONG_PRESS when tapped.
public function get target():DisplayObject public function set target(value:DisplayObject):void| LongPress | () | Constructor |
public function LongPress(target:DisplayObject = null)Constructor.
Parameterstarget:DisplayObject (default = null) |