fljot / Gestouch

Gestouch: multitouch gesture recognition library for Flash (ActionScript) development.
MIT License
356 stars 84 forks source link

Noob: Cant get get events firing. #63

Open dejv opened 10 years ago

dejv commented 10 years ago

Hi, im quite the beginner of AS3, probably shouldnt post here but im reaching out in hope to understand how things work.

Im looking for good detection of a double tap gesture using Gestouch. Im working in Flash Pro CC (bad IDE I know) targeting iOS with AIR 4 and when testing my app I keep getting this:

"Scene 1, Layer 'Layer 1', Frame 1, Line 418, Column 42
1119: Access of possibly undefined property GESTURE_RECOGNIZED through a reference with static type Class." 

I'm not quite sure what that means. I've tried attaching the event to Sprites and Movieclips but no cigar. The line it's referring to is where I add the event listener.

code:

import org.gestouch.core.Gestouch;
import org.gestouch.gestures.TapGesture;
import org.gestouch.events.GestureEvent;

var doubleTap:TapGesture = new TapGesture(newMarker);
doubleTap.numTapsRequired = 2;
doubleTap.addEventListener(GestureEvent.GESTURE_RECOGNIZED, onDoubleTap);

function onDoubleTap(event:GestureEvent):void
{
    trace("double tapped");
}

Hope anyone can point me in the right direction!

fljot commented 10 years ago

A quote from one of my e-mails:

A piece of a strong (STRONG) advice: don't use Flash CS for project compilation, and if you still do — don't write on the frames. The times of ActionScript1 have passed. You have this problem because of some inner conflict with the flash.events.GestureEvent (same will happen in MXML), in this case the only solution is to write the whole package

addEventListener(org.gestouch.events.GestureEvent.GESTURE_RECOGNIZED, ...

handler(event:org.gestouch.events.GestureEvent):void
fljot commented 10 years ago

I guess I have to write some FAQ, as the experience level of users is unexpectedly hmm various.

dejv commented 10 years ago

Thank you for the answer. I can see why that conflict would occur. I take it that is because the Flash IDE includes a bunch of stuff when compiling that another compiler would not?

And a FAQ would be great, as a wise man once said: "Anything that can go wrong — will go wrong." and as a human factors engineer, I have to say that that also includes user behavior.

Thanks for a great lib

simonfossom commented 10 years ago

Same problem. Didn't help me.

this is my first class where I initialze starling http://goo.gl/M4NTC8 this is my second class where I try to get tap to work http://goo.gl/m3dU06

Can you tell me if I've overlooked something? Thanks!