Stroke

From GestureWorks Tutorials
Jump to: navigation, search

Logo gestureworks flash.png

 

GWGestureEvent.STROKE

Gesture stroke lg.png

Using the Stroke Gestures
The Stroke gestures enable the ability to recognize and match a user defined vector path.

Mechanics and Code Samples
To register an ‘stroke’ event, the user places multiple fingers on an object, which will then realign itself based on the user's touch point configuration.

Enable the Stroke gesture on a TouchSprite ("myTouchSprite" in this example) by adding the gesture to the gestureList property for the TouchSprite:

  1. myTouchSprite.gestureList = {"letter_O":true};

Register an event for the gesture by listening for the ‘STROKE’ GWGestureEvent:

  1. myTouchSprite.addEventListener(GWGestureEvent.STROKE_LETTER, gestureStrokeHandler);

Finally, implement the script(s) that you want to respond to the event in a custom handler:

  1. private function gestureStrokeHandler(event:GWGestureEvent):void {
  2.     trace("g stroke: ", event.value.id, event.value.prob event.value.width, event.value.height);
  3. }

In this example, the match probability, width and height values of the Stroke gesture is being sent to the Output window.

Gestures can be utilized with a number of touch points. For detailed information about this gesture and more, consult the GestureML Wiki.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox