Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get an actor by name in libgdx

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?

like image 908
joshmmo Avatar asked Jan 18 '14 02:01

joshmmo


1 Answers

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. :)

like image 97
noone Avatar answered Nov 06 '22 08:11

noone