ExclusiveTouch
public class
feathers.events.ExclusiveTouch
Description
Allows a component to claim exclusive access to a touch to avoid dragging, scrolling, or other touch interaction conflicts. In particular, if objects are nested, and they can be scrolled or dragged, it's better for one to eventually gain exclusive control over the touch. Multiple objects being controlled by the same touch often results in unexpected behavior.
Due to the way that Starling's touch behavior is implemented, when objects are nested, the inner object will always have precedence. However, from a usability perspective, this is generally the expected behavior, so this restriction isn't expected to cause any issues.
API overview
Constructor
ExclusiveTouch
(
stage: Stage
)
Constructor
Functions
Public functions
| claimTouch ( touchID: Number , target: DisplayObject ): Boolean |
Allows a display object to claim a touch by its ID |
| disposeForStage ( stage: Stage ): Void |
static Disposes the exclusive touch manager for the specified stage |
| forStage ( stage: Stage ): ExclusiveTouch |
static Retrieves the exclusive touch manager for the specified stage |
| getClaim ( touchID: Number ): DisplayObject |
Gets the display object that has claimed a touch with the specified ID |
| removeClaim ( touchID: Number ): Void |
Removes a claim to the touch with the specified ID |
Constructor
ExclusiveTouch ( stage: Stage )
Constructor. @param stage
Functions
addEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Registers an event listener at a certain object.
Parameters
| type: String | |
| listener: Function |
claimTouch ( touchID: Number , target: DisplayObject ): Boolean
Allows a display object to claim a touch by its ID. Returns true if the touch is claimed. Returns false if the touch was previously claimed by another display object.
Parameters
| touchID: Number | |
| target: DisplayObject |
dispatchEvent
(
event: Event
): Void
Inherited from EventDispatcher
Dispatches an event to all objects that have registered listeners for its type. If an event with enabled 'bubble' property is dispatched to a display object, it will travel up along the line of parents, until it either hits the root object or someone stops its propagation manually.
Parameters
| event: Event |
dispatchEventWith
(
type: String
,
bubbles: Boolean
= false
,
data: Object
= null
): Void
Inherited from EventDispatcher
Dispatches an event with the given parameters to all objects that have registered listeners for the given type. The method uses an internal pool of event objects to avoid allocations.
Parameters
| type: String | |
| bubbles: Boolean = false | |
| data: Object = null |
disposeForStage ( stage: Stage ): Void
static
Disposes the exclusive touch manager for the specified stage.
Parameters
| stage: Stage |
forStage ( stage: Stage ): ExclusiveTouch
static
Retrieves the exclusive touch manager for the specified stage.
Parameters
| stage: Stage |
getClaim ( touchID: Number ): DisplayObject
Gets the display object that has claimed a touch with the specified ID. If no touch claims the touch with the specified ID, returns null.
Parameters
| touchID: Number |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
hasEventListener
(
type: String
): Boolean
Inherited from EventDispatcher
Returns if there are listeners registered for a certain event type.
Parameters
| type: String |
removeClaim ( touchID: Number ): Void
Removes a claim to the touch with the specified ID.
Parameters
| touchID: Number |
removeEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Removes an event listener from the object.
Parameters
| type: String | |
| listener: Function |
removeEventListeners
(
type: String
= null
): Void
Inherited from EventDispatcher
Removes all event listeners with a certain type, or all of them if type is null. Be careful when removing all event listeners: you never know who else was listening.
Parameters
| type: String = null |