Let’s pretend that I’m making a game where the character can move left or right. Currently, I only know how to do polling to detect a key press. Here is some psuedocode.
[AS]
while(1){
if(key == left)
moveCharacterLeft();
else
moveCharacterRight();
}
[/AS]
This is inefficient because it wastes CPU cycles when no keys are presed. In my computer science OS class, we recently learned about about signaling. It’s basically the above code without the while loop. The program does not repeatedly check what keys are pressed, rather the function is notified when a key is pressed. Is there an equivalent signaling method in actionscript?