I have an action that I declared in the -init method.
-(id) init
{
if( (self=[super init])) {
sprite = [CCSprite spriteWithFile:@"Icon@2x.png"];
sprite.position = ccp(150,150);
[self addChild:sprite];
sprite.tag = 13;
self.isTouchEnabled = YES;
CCAction *anAction = [CCBlink actionWithDuration:5 blinks:10];
anAction.tag = 15;
}
return self;
}
Now, I can access the sprite without any problems.
-(void)ccTouchesBegan:(NSSet *)touch withEvent:(UIEvent *)event {
CCNode *node = [self getChildByTag:13];
NSAssert([node isKindOfClass:[CCSprite class]],@"is NOT member of CCSprite");
CCSprite *sprite = (CCSprite *)node;
sprite.scale = CCRANDOM_0_1();
}
Now I don't know how to access my action via tag.. would anyone mind showing me a small example ?