Name: onKey[letter]Down and onKey[letter]Up
Author: senocular: www.senocular.com
Date:
1899-12-31T00:25:03.800
Documentation:
onKey[letter]Down - new events passed by the key object which
easily let you assign key events for specific characters. Simply
replace [letter] in onKey[letter]Down with the character you want
the event to be handled for and set up your function. Remember
to make the object a listener of the Key object.
onKey[letter]Up - Operates the same way on Key Up.
Example:
Key.addListener(this);
this.onKeyADown = function(){
trace("a pressed");
}
this.onKeyBDown = function(){
trace("b pressed");
}
this["onKey;Down"] = function(){
trace("; pressed");
}
1
2
3
4
5
6
7
8
9
Key.addListener(Key);
Key.onKeyDown = function(){
var dwn = String.fromCharCode(this.getAscii());
if (dwn.length) this.broadcastMessage("onKey"+dwn+"Down");
}
Key.onKeyUp = function(){
var up = String.fromCharCode(this.getAscii());
if (up.length) this.broadcastMessage("onKey"+up+"Up");
}