Hi!
I wanted to make some of my sprites run a “CCfadeIn” function and they did successfully BUT then i wanted to make them run a CCFadeOut function when the cctouchBegan and that won’t work, the sprites are not getting affected??
In my initializing where i run the CCFadeIn: 
In the ccTocuhBegan function:
And this won’t work, actually i can’t do anything to the sprites in any other functions after i ran the actions the first time(Where i made them FadeIn)?
Why!
Thanks!
Did you check if the codes in the if statement is executed? If it is not, then that means the part where you check whether your touch falls within the sprite bound is wrong.
Yup, it’s doesn’t work when I code it to run these actions outside the statement, I mean just when you just do a touch…?
But the objects can both fadeIn and fadeOut if I do it in the same function, like it works when I made the sprites fadeIn at the first and then fadeOut at the second, that works, but why doesn’t it work when I use different functions, it should work right?
Thanks!
@duracellrabbid
Did you declare the sprites in the header file?
If you only defined them in your init() function you won’t be able to access them from other functions.
Also, what version of cocos2d-x are you using?
How are the pointers to your sprites sprites created? Are they member variables of your scene?
How is the TouchBegan function implemented, is it a lambda function?
Please post a little bit more code.
And please don’t post screenshots. It’s hard to c&p those into test projects 
Use markup:
```
code
```
will give you nicely formatted code:
code
@i__d__k
Oh, you were faster… 
Like lightening

I’m not sure but aren’t CCAction, CCFadeIn, CCFadeOut deprecated? (or they removed the CC prefix?)
Yes, they are. But they still work.
But I didn’t want to create confusion, so I didn’t pointed it out. 
But nothing stays hidden before your eagle eyes…
Hi all!
Thanks for the replies/questions…
I am using v. 2.2.6…
And yup, both all those 4 members, 2 sprites and 2 CCLabelTTFs are declared in my header file of this class,
The TouchBegan function is just declared in the header file and btw, it won’t work in any other functions that’s not the same as the one i made the first action(CCFadeIn)…
@mausmausgames, @i__d__k
I haven’t worked with 2.x so I can’t say for sure but maybe if you posted some (formatted) code like @mausmausgames said you could get better answers.
Ah, ok…But there isn’t that much of a difference right? From 2 to 3…
In “ShowObjects” Function: [code] CCFadeIn* fadein = (CCFadeIn::create(1.5));
playSprite->runAction(fadein);
playSpritee->runAction((CCFadeIn*)fadein->copy());
GreenText->runAction((CCFadeIn*)fadein->copy());
YellowText->runAction((CCFadeIn*)fadein->copy());[/code]
In TouchBegan function(doesn’t work anywhere else afterwards the first time i made em run the fadeIn action): CCFadeOut* fadeout = (CCFadeOut::create(1.5));
playSprite->runAction(fadeout);
playSpritee->runAction((CCFadeOut*)fadeout->copy());
GreenText->runAction((CCFadeOut*)fadeout->copy());
YellowText->runAction((CCFadeOut*)fadeout->copy());
The only thing that comes to my mind: maybe you started the fadeOut before fadeIn ended.
You could call something like sprite->stopAllActions() before starting the fadeOut. I’m not sure, this method exists in v2.x, but there will be something similar for sure.
Other than that I need more code to reproduce your problem. A complete small test project would be nice…
There’s a lot of C++11 features used in v3.x and the naming has been changed (such as removing the CC prefix)
That’s the same code you posted earlier. You’ll have to show some more code (like maybe the touch listener) so I can try and figure out where the problem is.
@i__d__k
Harhar!
I was faster this time… 
http://static.memecdn.com/images/avatars/s_34434_4ff5074e84ab8.jpg
But if his FadeOut is in onTouchBegan() then your statement is not valid as he can touch the screen after the FadeIn end 
I know. He could. But one second and a half is a loooooooooong time.
Maybe he was impatient…
It’s always good practice to stop actions before starting new ones.
Haha, maybe.
I did not do stop actions in my game though…
We’ll find out if we get more code.
@i__d__k Your game has very few and simple actions. I get fighting actions all the time. I even made a PR to cocos2d-x at github to have an easier way to stop actions using a flag system. But I get the feeling we’re getting a bit off topic here… 
Yeah sorry. My bad 
Let’s just wait for @nichlaspro132