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

Errors when using swipe gesture with Starling #88

Open
Toinouze opened this issue Aug 4, 2015 · 2 comments
Open

Errors when using swipe gesture with Starling #88

Toinouze opened this issue Aug 4, 2015 · 2 comments

Comments

@Toinouze
Copy link

Toinouze commented Aug 4, 2015

Hi,

We have an error occuring when using a swipe gesture with Starling. Doesn't happen very oftern (1.5% of users), but still annoying :

Error: Not touch target found (hit test).Something is wrong, at least flash.display::Stage should be found.See Gestouch#addTouchHitTester() and Gestouch#inputAdapter.
   at org.gestouch.core::TouchesManager.org.gestouch.core::gestouch_internal::onTouchBegin()()
   at org.gestouch.input::NativeInputAdapter.touchBeginHandler()()

Here's our Gestouch initialization (done once at app launch):

Gestouch.inputAdapter ||= new NativeInputAdapter(Starling.current.nativeStage);
Gestouch.addDisplayListAdapter(DisplayObject, new StarlingDisplayListAdapter());
Gestouch.addTouchHitTester(new StarlingTouchHitTester(Starling.current), -1);

Here's how we create a swipe gesture :

swipeGesture = new SwipeGesture(this);
swipeGesture.direction = SwipeGestureDirection.HORIZONTAL;
swipeGesture.minOffset = Capabilities.screenDPI * 0.3;
swipeGesture.addEventListener(GestureEvent.GESTURE_RECOGNIZED, onSwipe);

As you can see, nothing complicated. The swipe gesture works fine, we cannot reproduce the bug on our device (as I said, only 1.5% of users are impacted).
We display full screen ads (with a native, non AIR view) on our app, maybe it's related ?

Any help would be greatly appreciated.

Thanks !

@fljot
Copy link
Owner

fljot commented Aug 4, 2015

It's not that you did something wrong, but that it needs to be "fixed" a bit. Read #86 for more info.

Add:

Gestouch.addDisplayListAdapter(flash.display.DisplayObject, new NativeDisplayListAdapter());
Gestouch.addTouchHitTester(new NativeTouchHitTester(stage));

Quick info to make it clear why so (if anyone will ever read this): it's because when input (touch/mouse event) happened, system (touches manager) couldn't find target for touch because there was only StarlingTouchHitTester registered and touch happened not over any Starling object. Adding these two lines will make it work with flash.display.DisplayObject also, fixing previously unresolved touch target.

@Toinouze
Copy link
Author

Toinouze commented Aug 5, 2015

Hi,

Thanks for your fast reply.

After adding the native adapter & touch hit tester, i got another error when clicking on anything :

Error: Display list adapter not found for target of type 'starling.display::Image'.
at org.gestouch.core::GesturesManager/org.gestouch.core::gestouch_internal::onTouchBegin()[O:\Dev\Gestouch\src\org\gestouch\core\GesturesManager.as:218]
at org.gestouch.core::TouchesManager/org.gestouch.core::gestouch_internal::onTouchBegin()[O:\Dev\Gestouch\src\org\gestouch\core\TouchesManager.as:151]
at org.gestouch.input::NativeInputAdapter/mouseDownHandler()[O:\Dev\Gestouch\src\org\gestouch\input\NativeInputAdapter.as:189]

Edit : nevermind, it was an import issue. We will put this in production and see if the problems is fixed. Thanks a lot !

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