package tools{
public class KeyIsDown{
private static var obj;
public static function init(stage){
obj = new Object();
stage.addEventListener("keyDown", keydownHandler);
stage.addEventListener("keyUp", keyupHandler);
}
public static function isDown(key){
return(obj[key] ? true : false);
}
private static function keydownHandler(event){
obj[event.keyCode] = true;
}
private static function keyupHandler(event){
obj[event.keyCode] = false;
}
}
}