Thanks a bunch for looking into this for me. Here is some example code that will cause the issue. Simply click and hold one of the buttons, wait for the alert, clear the alert, and the start clicking buttons again. You'll see that they get all wonky afterwords.
(Game H):
#import <Foundation/Foundation.h>
@interface Game : SPStage
SPTouch *buttonLeftPressed;
SPTouch *buttonRightPressed;
SPTouch *buttonLeftReleased;
SPTouch *buttonRightReleased;
int timerCountDown;
-(void)leftButtonPressed:(SPTouchEvent*)event;
-(void)rightButtonPressed:(SPTouchEvent*)event;
@end
(Game M)
#import "Game.h"
@implementation Game
- (id)initWithWidth:(float)width height:(float)height {
if (self = [super initWithWidth:width height:height]) {
SPQuad *gameButtonLeft = [SPQuad quadWithWidth:(150) height:(150)];
gameButtonLeft.color = 0xff0000;
gameButtonLeft.x = 0;
gameButtonLeft.y = 0;
[self addChild:gameButtonLeft];
SPQuad *gameButtonRight = [SPQuad quadWithWidth:(150) height:(150)];
gameButtonRight.color = 0xff0000;
gameButtonRight.x = 0;
gameButtonRight.y = 200;
[self addChild:gameButtonRight];
[gameButtonLeft addEventListener:@selector(leftButtonPressed:) atObject:self
forType:SP_EVENT_TYPE_TOUCH];
[gameButtonRight addEventListener:@selector(rightButtonPressed:) atObject:self
forType:SP_EVENT_TYPE_TOUCH];
timerCountDown = 0;
[self addEventListener:@selector(onEnterFrame:) atObject:self
forType:SP_EVENT_TYPE_ENTER_FRAME];
}
return self;
}
- (void)onEnterFrame:(SPEnterFrameEvent *)event
{
timerCountDown++;
if (timerCountDown == 50)
{
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Test Scenero" message:@"This is a alertbox that interups controls." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show];
}
}
-(void)leftButtonPressed:(SPTouchEvent*)event
{
buttonLeftPressed = [[event touchesWithTarget:self
andPhase:SPTouchPhaseBegan] anyObject];
buttonLeftReleased = [[event touchesWithTarget:self
andPhase:SPTouchPhaseEnded] anyObject];
if (buttonLeftPressed)
{
NSLog(@"Left Button Pressed");
}
if (buttonLeftReleased)
{
NSLog(@"Left Button Released");
}
}
-(void)rightButtonPressed:(SPTouchEvent*)event
{
buttonRightPressed = [[event touchesWithTarget:self
andPhase:SPTouchPhaseBegan] anyObject];
buttonRightReleased = [[event touchesWithTarget:self
andPhase:SPTouchPhaseEnded] anyObject];
if (buttonRightPressed)
{
NSLog(@"Right Button Pressed");
}
if (buttonRightReleased)
{
NSLog(@"Right Button Released");
}
}
@end