Reputation: 1075
I added an inputlistener in a stage and in actor A. I only want to fire the event in the stage's listener if the actor being touched is not actor A.
Is there any implemented function that I can use in the listener of the stage to check if an actor is touched? Or prevent the stage's event from firing inside actor A's event.
i.e inside stage's touch down:
if(*actor touched is not A*)
//do some stuff
or in actor A's touch down, don't fire the stage's event.
Upvotes: 0
Views: 191
Reputation: 11984
All of the InputListener
events provide an InputEvent
which in turn provides the Actor
on which the event was performed via getTarget()
. For example, if you are handling the touchUp
event:
public void touchUp(InputEvent event, float x, float y, int pointer, int button)
{
if (!A.equals(event.getTarget()))
{
// Handle the event
}
}
Upvotes: 1