e.keyCode is an integer. When the onKeyDown
gets called, the code uses the integer to set a value in the array to true.
For example, if the RIGHT key is pressed on the keyboard, e.keyCode would be 39, so the code is the same as keys[39] = true;
.
If you look at the documentation for Keyboard you will see that Keyboard.RIGHT is defined as 39. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/ui/Keyboard.html
On the next frame the update event fires. When you write an if statement without an ==, it kinda does it for, so the if statement is essentially saying
if(keys[39] == true) {
ball.x += 5;
}