Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

Flash DisplayObjects triggering touch began events in Starling? #1064

Closed jgranick closed 4 years ago

jgranick commented 4 years ago

I've received this pull request:

https://github.com/openfl/starling/pull/141

Does this occur in the Flash version of Starling?

If Flash DisplayObjects do still trigger events on Starling below it would be great to know if this kind of change would be desirable here in the ActionScript version of Starling, or if this is desired behavior or possibly OpenFL is working differently in this area

Thank you for your help!

jgranick commented 4 years ago

Oh, so nativeOverlayBlocksTouches is what this is for?

...what happens if the user clicks a display object outside of the native overlay Sprite?

Thank you again

PrimaryFeather commented 4 years ago

Hey Joshua, sorry for the late reply! Somehow this message got lost in the pre-holiday madness. :wink:

The property nativeOverlayBlocksTouches makes flash.display DisplayObjects behave just like you would expect them to behave if they were starling.display DisplayObjects, i.e. if you click on such an object, the objects beneath won't receive any Touch events.

With that property disabled, both Flash and Starling will receive the mouse/touch event, which makes it rather difficult to handle properly.

In both cases, if you click on outside the flash.display objects, Starling will receive the touches just as usual.

Is that what you wanted to know? Cheers!

jgranick commented 4 years ago

Okay I think that makes sense

So if you want a Flash display object to block touches/clicks to Starling then you must add it to the nativeOverlay Sprite?

PrimaryFeather commented 4 years ago

Yes, that behavior is currently implemented only for the native overlay.