# Array call

**URL:** https://forum.kirupa.com/t/array-call/284223
**Category:** Uncategorized
**Created:** [March 16, 2009, 9:02pm UTC](https://forum.kirupa.com/t/array-call/284223 "2009-03-16T21:02:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![autumnmedia](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@autumnmedia](https://forum.kirupa.com/u/autumnmedia)
#### Post date: [March 16, 2009, 9:02pm UTC](https://forum.kirupa.com/t/array-call/284223/1 "2009-03-16T21:02:52Z")

</div>

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,

```auto
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…

```auto
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
