problem when upate Frame of CCSprite

problem when upate Frame of CCSprite
0.0 0


Hi,problem is like below:
I have one sprite instance ‘sprite_ins’ which display image ‘a.jpg’, when I click one button I update ‘sprite_ins’ to display ‘b.jpg’ in ccTouchesEnded function. Then I will check to see if I should display ‘b.jpg’, if not, I will change to display ‘a.jpg’ again.
Code is like below:

void A::ccTouchesEnded(cocos2d::CCSet touches, cocos2d::CCEventevent)
//by default, sprite_ins will display a.jpg
//get frame of ‘b.jpg’
sprite_ins~~>setDisplayFrame;// display b.jpg
//then I did some calculation, and need to check
if//if we should not display B, but I want the user see a.jpg~~>b.jpg~~>a.jpg.


when I run the app , I found the sprite will always display a.jpg, it seems sprite_ins->setDisplayFrame(b);// display b.jpg never works. Could you explain to me why this happened?


Can anybody help?