Ok, im looking in the Texture2D example code and ran into this (the callBack function):
-(void) imageLoaded: (Texture2D*) tex
{
// IMPORTANT: The order on the callback is not guaranteed. Don't depend on the callback
// This test just creates a sprite based on the Texture
Sprite *sprite = [Sprite spriteWithTexture:tex];
sprite.anchorPoint = ccp(0,0);
[self addChild:sprite z:-1];
CGSize size =[[Director sharedDirector] winSize];
int i = imageOffset * 32;
sprite.position = ccp( i % (int)size.width, (i / (int)size.width) * 32 );
imageOffset++;
}
since tex is an id node and you cannot depend on the order being correct, how do you ensure that "background1.jpg" is assigned to the correct "level1Background" texture? The order is kind of important.