Hi i currently have an if for keyboard input,
at the moment i have if R is pressed, perform the action
what i want is, if letter[number] is pressed, which will be a selected letter from the array,
perform the task,
override function keyDownHandler(e:KeyboardEvent):void { //override any other key operations
if(String.fromCharCode(e.keyCode) == 'R') {
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
}
is my current code,
i tried this…
override function keyDownHandler(e:KeyboardEvent):void { //override any other key operations
if(String.fromCharCode(e.keyCode) == letter[1]) {
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
}
but it didnt work
any help please
thanks