Help figuring out "priority of button pressed type thing"

Okay so I have a game I've been working on and I have a "left" and "Right" button to move my character. They both work off of a boolean, so if touch is pressed change right to true and then i have the moving rules in the character ect... I also have another feature so when touch.count is
=2 the player will in a sense switch gravity. Now my moving rules and gravity switch work great, my problem is I'am trying to figure out a way to do lets say, if I'm pressing my right arrow and my player is moving to the right if I happen to press the left to switch gravity I don't want my player to try and pull to the left. Right now if I'm hold right and moving to the right if i press left he still switches gravity which is good but he also pauses of wants to change directions to the left completely. What I'm trying to figure is if there is a way to make it so say, if game.right is true and my player is moving to the right if i press left I want the moving attributes to be null and void for for the player only to switch gravity and continue moving to the right and vice versa kind of a priority type thing of which ever direction was pressed first is that only one executable at the time. I already have if so that if right is true then left is false but that doesn't really do anything.
Any help of insight would be greatly appreciated.
=2 the player will in a sense switch gravity. Now my moving rules and gravity switch work great, my problem is I'am trying to figure out a way to do lets say, if I'm pressing my right arrow and my player is moving to the right if I happen to press the left to switch gravity I don't want my player to try and pull to the left. Right now if I'm hold right and moving to the right if i press left he still switches gravity which is good but he also pauses of wants to change directions to the left completely. What I'm trying to figure is if there is a way to make it so say, if game.right is true and my player is moving to the right if i press left I want the moving attributes to be null and void for for the player only to switch gravity and continue moving to the right and vice versa kind of a priority type thing of which ever direction was pressed first is that only one executable at the time. I already have if so that if right is true then left is false but that doesn't really do anything.
Any help of insight would be greatly appreciated.
Comments
Also , why moving left and right (X axis) affects your gravity (Y axis) , meaning , you said: "he also pauses of wants to change directions to the left completely"
How is he pausing? what rule do you use?
Roy.
change att (self.gravityconstrain) to (self.gravityconstrain*-1) and my play will switch gravity, and I have a boolean on top of that telling it when switching gravity can be true. So the problem is that when i going to the right and right is "true" when I press left while holding right it wants to make left "true" and change my characters direction, when I i want is to have him only change gravity and not directions. Some how make left null while right is true and just treat that area like the rest of the screen and just switch gravity.
and tell it that it can only be pressed if "right" is false .
Another suggestion is to tell you right/left button actors that they can be pressed only if "touch count" = 0
Roy.
Thanks a bunch! Just a act of writing this and saying everything out loud while i was typing it made me think the same.