Here is my trouble.
- When the button is off it hase value 0.
- When it is pressed it turns to 1.
- When it is released it gets back to 0.
Now I was using the following code to listen to change event:
if (obj[0].state.A === 1) {
//do some thing
}
The problem is I have the function that wraps around my code.
It is TICK function which resets $obj.state.A to 0 if it is not pressed.
It ticks every 0.10ms.
Now here is where the problem is, $if (obj[0].state.A === 1) gives my code that executes when the button is down.
But I need to make it happen on button up! event and only once in one press.
How do I do that?
I found it!
This is how I did it: