I am making an audio button, my question is how do you change the defaultFile image of the button when it has been clicked to reflect if there is or no sound.
What I want is that if a user clicks the button to mute or resume, the image of the button changes accordingly and stays like that until the user clicks again.
You don’t want a widget.newButton for this. Button’s don’t have an on/off state. They only have a is currently being pressed or not and trigger an action. What you want is a widget.newSwitch. Switchs maintain an on/off state. In particular you should probably use a “checkbox” style switch. It’s easily skinnable to have it look like you want. You just need an image sheet with two identically sized frames, one for on, one for off and pass in a couple of parameters.
You don’t want a widget.newButton for this. Button’s don’t have an on/off state. They only have a is currently being pressed or not and trigger an action. What you want is a widget.newSwitch. Switchs maintain an on/off state. In particular you should probably use a “checkbox” style switch. It’s easily skinnable to have it look like you want. You just need an image sheet with two identically sized frames, one for on, one for off and pass in a couple of parameters.