{Flash 5} Controlling buttons by pressing keys?

(Flash 5)

I have 12 different buttons that are keyboard keys that play a sound when you click on them. I am wondering if, in addition to that, one could hit, for instance, the ` key for this first one, the 1 key for the second one, the 2 key for the third one, etc…etc…

Is there a script for that, in addition to the click?

Thanks!

Hi,

you can use this in a button:


on (release, keyPress"1") {
     doSomething();
}

or you can use this in a (controller) movieClip:


onClipEvent(keyDown){
   if(key.getCode == 49){ //49 is the key code for number 1
      doSomething();
   }
}

Find the the key codes in the Flash help.

Cheers

SHO