Sign in to follow this  
riccioverde11

Nested Event Listeners problem

Recommended Posts

Hello community,

I have a Graphics, say a circle, and inside i nest another circle with addChild property.

If to both the graphics i add a listener such as "mouseover", how do i prevent the "father" to fire when i'm just hovering the "child" circle?

 

Regards.

Edited by riccioverde11

Share this post


Link to post
Share on other sites
11 hours ago, Vlados said:

You can use property .currentElement to check possition of your mouse (above which element it is - whether parent of child)  

Also take a look at optional third parameter of eventlistener - capturing

Apparently stopPropagation should do the job in a more succinct way. About the third parameter, where did you find the docs? Cause on my intellisense the third parameter is context.

Also

11 hours ago, ivan.popelyshev said:

I tried this solution and it works fine, although I have another issue now. The inner circle will stop the propagation much so, that if now i actually hover on the father, it won't trigger anything.

My best guess is that by stopping the propagation the father lost his chance to fire. Do i have to manually call it?

 

Edited by riccioverde11

Share this post


Link to post
Share on other sites
2 hours ago, riccioverde11 said:

where did you find the docs? Cause on my intellisense the third parameter is context.

 

Intellisense is not perfect, sometime you need help him, especially for events.
Am not using maybe the best solution but it work for me.
yyIQcbUM_o.png

Edited by jonforum

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.