MenuItems should allow click-throughs when they are disabled and
hidden, right? Both the Sound Off and Sound On buttons are placed
onscren in other code. I can get these two buttons to turn themselves
on and off when they are offset from each other, but when they have
the same X/Y positions, the TurnOff button works, revealing the TurnOn
button in the same spot, but the TurnOn button won't register the
press. The only difference is the position . Any ideas?
>From my implementation file:
-(id)initEtc
{
...
turnSoundOffButton = [assetMgr
menuItemImageWithNormal:@"mainButtonSoundOff"
selected:@"mainButtonSoundOff"
target:self
selector:@selector(turnSoundOffAction:)];
turnSoundOnButton = [assetMgr
menuItemImageWithNormal:@"mainButtonSoundOn"
selected:@"mainButtonSoundOn"
target:self
selector:@selector(turnSoundOnAction:)];
Menu *menu = [Menu menuWithItems:playButton, aboutButton, infoButton,
tutorialButton, statsButton,
hardHatButton, turnSoundOffButton,
turnSoundOnButton, nil];
...
[turnSoundOnButton setIsEnabled:NO];
[turnSoundOnButton setVisible:NO];
...
}
-(void)turnSoundOffAction:(id)sender {
NSLog(@"[MenuLayerMain] turnSoundOffAction()");
[SoundManager setSoundFxOn:NO];
[SoundManager setMusicOn:NO];
[turnSoundOffButton setIsEnabled:NO];
[turnSoundOffButton setVisible:NO];
[turnSoundOnButton setIsEnabled:YES];
[turnSoundOnButton setVisible:YES];
}
-(void)turnSoundOnAction:(id)sender {
NSLog(@"[MenuLayerMain] turnSoundOnAction()");
[SoundManager setSoundFxOn:YES];
[SoundManager setMusicOn:YES];
[turnSoundOffButton setIsEnabled:YES];
[turnSoundOffButton setVisible:YES];
[turnSoundOnButton setIsEnabled:NO];
[turnSoundOnButton setVisible:NO];
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---