I made a "game over" text appears at the end of the game and added addeventlistener to the self.stage on touch. when this touched, it should execute the event function which loads the first screen of the game. however, on the first screen I have in the middle of the screen click to play text which has its own touch event.
In the simulator, if I click in the middle of the screen on the game over screen, it automatically also record event for click to play and the game starts.
-I don't think the eventhandler of click to play sticks around, because I use [self removeAllChildren] when game starts. also, I tested during game play by clicking in the same area and correctly no touch event records for click to play.
Edit:
I made a workaround for this, but not sure if that's an optimal solution:
I made the onevent touch start after an interval of time using NSTimer
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(attachEventToStart:) userInfo:startTextField repeats:NO];
then in attachEventToStart:
-(void)attachEventToStart:(NSTimer *)theTimer
{
SPTextField *startTextField = [theTimer userInfo];
[startTextField addEventListener:@selector(gameStartOnTouch:) atObject:self forType:SP_EVENT_TYPE_TOUCH];
}
this worked, if anyone have a better solution would be great