I added a srpite image.I will use it as button.When I press it,it should effect like in code below.It works only when I wrote toouch.event.action_down.But I want when my finger is up, the button should return stuation beforel like in code below.but it doesn’t work.
Sprite spriteMusicPicture1 = new Sprite(726.0f, 350.0f, mFaceTextureRegion7){
@Override
public boolean onAreaTouched(final TouchEvent pAreaTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
switch(pAreaTouchEvent.getAction()) {
case TouchEvent.ACTION_DOWN:
this.setScale(1.25f);
this.setAlpha(0.5f);
case TouchEvent.ACTION_UP:
this.setScale(1.0f);
this.setAlpha(1.0f);
}
return true;
}
};
After each
caseyou have to put a break; otherwise it will not stop and continue executing all the lines