Im currently trying to implement an clickListener. I found a great tool with runtime, its called Overlap2D, there i made some nice buttons and loaded them, it all works fine. Because i wanted to make a "hover" effect for my buttons, i used the ClickListener with the methods enter and exit, it looks so :
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor){
playButton.setLayerVisibility("MouseOver", true);
playButton.setLayerVisibility("pressed", false);
playButton.setLayerVisibility("normal", false);
System.out.println("Actor enter : "+fromActor);
}
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor){
playButton.setLayerVisibility("MouseOver", false);
playButton.setLayerVisibility("pressed", false);
playButton.setLayerVisibility("normal", true);
System.out.println("Actor exit : "+toActor);
}
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){
System.out.println("touchdown");
return true;
}
@Override
public void touchUp (InputEvent event, float x, float y, int pointer, int button){
System.out.println("touchup");
}
And heres the problem, touchdown and touchup are called one time, when i touch down the button or up. But the enter and exit methods are also called during the touchdown and touchupo event O.o that looks so:
touchdown
Actor enter : null
Actor exit : Image
Actor enter : Image
touchup
Actor exit : Image
Actor exit : Image
Actor enter : Image
Actor exit : Image
Actor enter : Image
I printed the fromActor and toActor also for debugging ^^ And i still dont know why it fires the exit and enter event so much ... Any one got an idea?
Thanks :)