java - Programically click on the button in scene 2D LibGDX -


i want programically click on button1 whenever pressed on button2 (after clicked on button2 button1 show style.down style.up , function in clicklistener). found similiar issue on that post doesnt work me.

in android have call performaction() method, couldnt find similiar method using libgdx library

i figure out :

the solution (inspired this post)

button2.addlistener(new clicklistener(){             @override             public boolean touchdown(inputevent event, float x, float y, int pointer, int button) {                 inputevent event1 = new inputevent();                 event1.settype(inputevent.type.touchdown);                 button1.fire(event1);             return true;             }             @override             public void touchup(inputevent event, float x, float y, int pointer, int button) {                  inputevent event2 = new inputevent();                 event2.settype(inputevent.type.touchup);                 button1.fire(event2);               dosmth();              }         }); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -