Copy link to clipboard
Copied
I am starting out using Action Script on flash cs4 and found out that whenever I try to use the Keyboard class e.g Keyboard.DOWN I always get "1120: Access of undefined property Keyboard."
Sorry if this has answered before but I cannot seems to find similar question. Here is a very simple AS3 I created trying to play around with the keyboard. Please do help me
package {
import flash.display.*;
import flash.events.*;
public class Main extends MovieClip{
public function Main(){
stage.addEventListener(KeyboardEvent.KEY_DOWN, movements);
function movements(event:KeyboardEvent){
if(event.keyCode == Keyboard.LEFT);
trace("success");
}
}
}
}
you forgot to import it:
import flash.ui.Keyboard;
Copy link to clipboard
Copied
you forgot to import it:
import flash.ui.Keyboard;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now