How do I get an actor by name in libgdx?
I currently have the following ChangeListener:
ChangeListener colorPickerListener = new ChangeListener()
{
public void changed(ChangeEvent event, Actor actor)
{
//Popup Window
toolboxStage.addActor(blockWindow);
//toolboxStage.getRoot().removeActor(blockWindow);
Gdx.app.log("LevelEditorScreen", "Color Picker Selected");
Gdx.app.log("LevelEditorScreen", "HUD Width: " + HUD_WIDTH);
Gdx.input.setInputProcessor(toolboxStage);
}
};
The actor that is above is the actor that has been touched. Once this particular actor has been touched I need to change the color of another actor. How exactly do I go about getting that actor by its name?
I would like to point out that there is already a method which finds an Actor
by name.
It works like this: stage.getRoot().findActor(name)
.
No need to implement it yourself. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With