Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot register CLICK events on items inside an item dragged with Gestouch #93

Open
PippoFlash opened this issue Oct 30, 2015 · 2 comments

Comments

@PippoFlash
Copy link

Hi,
I have a Sprite who can successfully been panned around.
There are children of this sprite which are registered to listen to CLICK events.
Those events do not get fires. If I activate the TAP event in gestouch, target.target registers the container sprite, not the InteractivObjects inside the sprite.
Tried all possible permutations. Any suggestion?
thanks
BTW Gestouch rocks.

@fljot
Copy link
Owner

fljot commented Oct 31, 2015

Gestouch doesn't stop any events propagation. Everything works just fine.

package {

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TouchEvent;

import org.gestouch.core.Gestouch;
import org.gestouch.events.GestureEvent;
import org.gestouch.extensions.native.NativeDisplayListAdapter;
import org.gestouch.extensions.native.NativeTouchHitTester;
import org.gestouch.gestures.PanGesture;
import org.gestouch.input.NativeInputAdapter;

public class Main extends Sprite {

    public function Main() {

        Gestouch.inputAdapter = new NativeInputAdapter(stage);
        Gestouch.addDisplayListAdapter(DisplayObject, new NativeDisplayListAdapter());
        Gestouch.addTouchHitTester(new NativeTouchHitTester(stage));

        var pannable:Sprite = new Sprite();
        addChild(pannable);

        var pan:PanGesture = new PanGesture(pannable);
        pan.addEventListener(GestureEvent.GESTURE_BEGAN, onPan);
        pan.addEventListener(GestureEvent.GESTURE_CHANGED, onPan);

        var child:Sprite = new Sprite();
        child.graphics.beginFill(0xCCCCCC);
        child.graphics.drawCircle(0, 0, 100);
        child.graphics.endFill();
        child.addEventListener(MouseEvent.CLICK, onChildTouch);
        child.addEventListener(TouchEvent.TOUCH_BEGIN, onChildTouch);
        child.addEventListener(TouchEvent.TOUCH_END, onChildTouch);
        pannable.addChild(child)
    }

    private function onPan(event:GestureEvent):void
    {
        trace("gesture recognized", event);
    }

    private function onChildTouch(event:Event):void
    {
        trace("child interactive event", event);
    }
}
}

@PippoFlash
Copy link
Author

Weird since it doesn't work to me. I had to implement event tunneling, probably because I use a personal events framework quite complex, it gets in the way somehow. Thank you for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants