Alright I'm new to Keyboard event listeners so I might be making a really obvious mistake that I don't know about. But what I want to do is, when someone types the letters for the word 'BROTHER', then it appears on the screen and it moves to the next frame.
Here's the code I have atm
I currently have the letters for 'BROTHER' each as a movie clip. The instance names are, RKey, OKey, etc.
ActionScript Code:
BKey.visible=false;
RKey.visible=false;
OKey.visible=false;
TKey.visible=false;
HKey.visible=false;
EKey.visible=false;
R2Key.visible=false;
import flash.events.KeyboardEvent;
//keycodes
var b:uint = B;
var r:uint = R;
var o:uint = O;
var t:uint = T;
var h:uint = H;
var E:uint = E;
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownListener);
function keyDownListener(e:KeyboardEvent) {
if (e.keyCode == b){
BKey.visible=true;}
if (e.keyCode == r){
RKey.visible=true;
R2Key.visible=true;}
if (e.keyCode == o){
OKey.visible=true;}
if (e.keyCode == t){
TKey.visible=true;}
if (e.keyCode == h){
HKey.visible=true;}
if (e.keyCode == E){
EKey.visible=true;}
if (BKey._visible && R2Key._visible && RKey._visible && OKey._visible && TKey._visible && HKey._visible && EKey._visible) {
gotoAndStop(26);
}
}
Here's the problem I'm getting though.
1120: Access of undefined property B.
var b:uint = B;
1120: Access of undefined property R.
var r:uint = R;
1120: Access of undefined property O.
var o:uint = O;
etc. (goes on to other letters as well)
Now, is this the only mistake in my thing? Or are there more mistakes? How do I fix it?
Thanks!