ikkleh Posted January 17, 2017 Share Posted January 17, 2017 Hi all, I have an interactive container containing multiple children. I want to be able to detect a click/touch event on a specific child object. Can I add a touch event to the parent container and somehow deduce the touched child from that? Or do I need to attach a touch event to each individual child clip? Thanks in advance Quote Link to comment Share on other sites More sharing options...
themoonrat Posted January 17, 2017 Share Posted January 17, 2017 I'd rather do the later where possible, but If you wanted to do the former, then on a click/touch event callback from the parent you get can interactionEvent. interactionEvent.data.global will give you a Point object with the global x and y co-ordinates of the click/touch. If the children are a sprite/graphic, you can use that to call their containsPoint function; if not, you'll have to create your own similar function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.