Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Touch Events in Container Children


ikkleh
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...