I have several objects overlapping. Each of these objects have click event.
When I click on the top object (the one which is on the top of all others), all the click events are triggered (each object event click are triggered).
I would like that only the top object event click to be triggered.
How do I to do that ?
Hmm, maybe a repeat for each object that the touch is on.
First set var selected of objects and scene variable to 0, then the for each loop:
If zorder of object > scene variable
Do +1 to a scene variable.
At the end of the loop, if zorder=scene var-1
Set var selected of object to 1.
Then your click activate event on objects with var selected=1
Thanks but I don’t understand how to get all objects clicked.
How do you do that ?
I thought that’s your problem. That you click all overlapping objects at once.
For the for each loop You need to put all you clickable objects in an object group. Then use group name instead of object name
Hmmm it makes sense. I will give it a try.
Puedes ocultar los demás objetos y a medida que das clic se oculta uno y el siguiente se muestra. Pero debes colocar que los objetos ocultos no activen su evento mientras no sean visibles.
this is what i ment.
this way you will delete the object with the highest Z-Order (the object on top)
you can use any action you want on the object. you should make sure, that every object has a unique z order.
Also if you create new objects, you should make sure that every object you can click on gets a +1 to its zorder on creation.