I have a case statement that detects what key has been pressed on a keyboard,
at the moment i have four different cases for four different letters,
how would i go about making a case that changes depending on what key is pressed,
for example, i have letters falling down the screen, and i need it so that if there is an R on screen the user has to press an R etc…
at the moment im using,
override function keyDownHandler(e:KeyboardEvent):void { //override any other key operations
switch (String.fromCharCode(e.keyCode)) { //switch statement checks letter pressed in
case 'T' : //if T is pressed
for (var i:uint=removeNum; i<clip; i++) {
hitTarget = this.getChildByName("letter"+i); //gets the correct letter clip
if (hitTarget.hitTestPoint(leftSmall.x, leftSmall.y, true)) { //if its hit the perfect circle
removeChild(hitTarget); //remove the clip
removeNum++; //add one to numebr removed
small=true; //small true
score+=10; //add to the score
energy.gotoAndPlay(energy.currentFrame-40); //increase energy
perfectClip.gotoAndPlay(2); //play the perfect clip
return; //exit
}
any suggestions at all?