Q: Passing int between 3 classes in cocos2d I have 3 classes namely GameScene, HomeScene and RecordsScene and I am trying to pass an integer value from GameScene to the RecordScene. My problem is, once the game is done, it goes home, then you have to click on Records to see the Records. Basically, the order of the three classes would be something like this: 
GameScene --> HomeScene --> RecordScene 
What I've been trying to do was pass the integer value from GameScene to the HomeScene then from the HomeScene, I'll pass it to the RecordScene but when I get there, the value of the integer is still 0. Here's my current code:
//GameScene
-(void)goHome:(ccTime)dt
{
HomeScene *home = [HomeScene node];
//myInt is an integer I declared on the HomeScene class, the value changes depending on the stage
home.layer.myInt = 1;
[[CCDirector sharedDirector]replaceScene:home];}

//HomeScene
-(void)viewRecord:(id)sender
{
//View record
RecordScene *record = [RecordScene node];
//lastStage is the integer from RecordScene I'm passing the value of myInt into
record.layer.lastStage = myInt;
[[CCDirector sharedDirector]replaceScene:record];}

I'm implementing the classes like so:
@implementation HomeScene
@synthesize layer;

-(id)init
{
if((self =[super init]))
{
    self.layer = [HomeSceneLayer node];
    [self addChild:layer];
}
return self;
}
@end

@implementation HomeSceneLayer
@synthesize myInt;
//methods
@end

Then my header looks something like so:
@interface HomeScene : CCLayer
{
int myInt;}
@property(nonatomic)int myInt;
@end

@interface HomeScene : CCScene
{
HomeSceneLayer *layer;
}
@property (nonatomic, retain)HomeSceneLayer *layer;
@end

Why is it resetting back to 0 and how do I pass the integer value from the GameScene to the RecordScene?

A: @synthesize myInt; creates an iVar _myInt.
RecordScene *record = [RecordScene node];
//lastStage is the integer from RecordScene I'm passing the value of myInt into
record.layer.lastStage = myInt;

you are setting record.layer.lastStage to myInt (iVar of HomeScene). Try record.layer.lastStage = self.layer.myInt;
From Apple's coding guidelines at https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html

Make sure the name of the instance variable concisely describes the attribute stored. Usually, you should not access instance variables directly, instead you should use accessor methods (you do access instance variables directly in init and dealloc methods). To help to signal this, prefix instance variable names with an underscore (_), for example:

Xcode now (I don't know since when) also synthesizes properties automatically, naming the iVar for @property [...] foo _foo. 
