I need to make a button with texture. After button is pressed I want to change texture of button permanently. For example on/of sound button. I tried this but it changes image only while I hold button.
Thanks
mSoundButton = new ButtonSprite(30, 30,
ResourceManager.getSoundButtonTR(),
//tiled texture region with image for sound on and sound off
ResourceManager.getEngine().getVertexBufferObjectManager()) {
@Override
public boolean onAreaTouched(TouchEvent pTouchEvent,
float pTouchAreaLocalX,
float pTouchAreaLocalY) {
if(pTouchEvent.isActionDown()) {
SFXManager.toggleSoundEnabled();
this.setCurrentTileIndex(1);
}
return super.onAreaTouched(pTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
}
};
mScene.registerTouchArea(mSoundButton);
mScene.attachChild(mSoundButton);