On (keyPress "83")

I’m a newbie at flash. I’ve read a few kirupa tutorials and did a simple flash playing a sound file. In it, I’ve created a button that will toggle sound on and off (thanks to the forum here I managed to figured that out) too.

But I’m trying to add more functionality to the flash because some of the users are disabled and have the option to press the keyboard would be better than to negotiate the mouse. So I tried adding on key press to no avail. I searched the forum but didn’t find the specific solution I wanted. I also couldn’t use OnClipEvent since the button is not a MC but a button.

Below are my actionscript codes for the button, would anyone be kind enough to tell me why it’s not working and how to get it to work?


on(release){
        if(music){
	_root.bgSound.stop();
	music = false;
        } else {
	bgSound = new Sound(this);
	bgSound.attachSound("narration");
	bgSound.start(0, 99);
	music = true;
        }
}


on (keyPress "83") {
	if(music){
		_root.bgSound.stop();
		music = false;
	} else {
		bgSound = new Sound(this);
		bgSound.attachSound("narration");
		bgSound.start(0, 99);
		music = true;
	}
}

Any help is appreciated. Thanks in advance.