Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Get the currently clicked/moving object? — Gideros Forum

Get the currently clicked/moving object?

______ Member
edited July 2012 in General questions
I have listeners on my complete page for mouseDown, mouseUp, mouseMove, but not on individual objects.

Is the only way to get the currently clicked object to traverse all the objects I've created on the screen, and do a hit test? or am I missing something?
People call me "underscore".

Comments

  • you can do it as you said only but not sure if it is a good programming or not.
    In your listener get Event.x and Event.y and then compare with yoor objects x and y.
    (object:getX(), object:getY() )
    Make a hit test like that.
  • by the way you posted the same topic 2 times :\">

    Dislikes: anneMurielle

    +1 -1 (+0 / -1 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    I'd say it is much easier to set up event listener for each object's instance and do the hitTestPoint inside it and add event:stopPropagation() in the end of function if hitTestPoint returned true, so event won't to complete page event handler.
  • ______ Member
    Hmm. stopPropagation sounds like a good idea. I think I'll go with this.

    Any idea of any performance hit doing this vs a single listener?
    People call me "underscore".
  • ______ Member
    by the way you posted the same topic 2 times :\">
    Yeah, don't know how. I cannot find a way to delete it or report the thread for deletion :\
    People call me "underscore".
  • ar2rsawseenar2rsawseen Maintainer
    by the way you posted the same topic 2 times :\">
    Yeah, don't know how. I cannot find a way to delete it or report the thread for deletion :\
    Don't worry, it'll be dealt with once any of the mods see it.
    Hmm. stopPropagation sounds like a good idea. I think I'll go with this.

    Any idea of any performance hit doing this vs a single listener?
    I don't think there should be any difference
Sign In or Register to comment.