i am trying to set texture with this :
[[self setSpriteByTag] setTexture:[[CCTextureCache sharedTextureCache] addImage:[NSString stringWithFormat:@"%@0001.png",face]]];
when [self setSpriteByTag] return a sprite face is an image string, and they both ok because i have logged them.
this sprite is a child of a page in ccscrolayer :
one page of the layer pages :
CCLayer *page1 = [[CCLayer alloc] init];
BACK.position=ccp(screenSize.width/2,screenSize.height/2);
[page1 addChild:BACK];
when i was trying to change BACK‘s image , with the command i wrote here.
what happen is that i see a white screen.
i have check that the image is in my assets .
what could be the problem ?
the facr that i change a sprite that is a child of a page ?
edit :
this is the function that gives me the sprite BACK:
-(CCSprite*)setSpriteByTag
{
int currentPage=[scroller currentScreen];
[globals sharedGlobals].currentPageG=currentPage; //move to touch ended?
currentPage=currentPage+1;
//NSLog(@"PAGE:%d",currentPage);
if(currentPage==1)
{[globals sharedGlobals].WhatFace =@"BeastFace"; return BACK;}
else if(currentPage==2)
{[globals sharedGlobals].WhatFace =@"BlueFace"; return BACK1;}
else if(currentPage==3)
It gets white only in case when image is not present in the resources.. I checked running same code.. It works fine.. If I put wrong name of the image which is not present.. It changes to white… Please check for the image
M sure problem is in the image name.. 🙂