I’m having some trouble with keyboard detection. Strangely, I’m able to accomplish mouse detection, but for some reason the listeners that I’ve tried for the keyboard do not work. Here is the code that I’m using to create a spacebar toggle in Flash 8 Pro with AS 2.0, any thoughts?
var polarity:Number = 1;
PSwitch = new Object();
PSwitch.onKeyDown = function(){
Key.getAscii();
if (Key.getAscii() == 32){
if (polarity = 1){
polarity =0;
} else if (polarity = 0){
polarity = 1;
}
Key.addListener(PSwitch);