Acá te paso un ej de un sencillo teclado numerico
Código ActionScript :
uno_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
dos_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
tres_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
cuatro_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
cinco_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
seis_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
siete_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
ocho_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
nueve_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
cero_btn.addEventListener(MouseEvent.MOUSE_DOWN, Action);
uno_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
dos_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
tres_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
cuatro_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
cinco_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
seis_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
siete_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
ocho_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
nueve_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
cero_btn.addEventListener(MouseEvent.MOUSE_UP, EndAction);
uno_btn.num_txt.text="1"
dos_btn.num_txt.text="2"
tres_btn.num_txt.text="3"
cuatro_btn.num_txt.text="4"
cinco_btn.num_txt.text="5"
seis_btn.num_txt.text="6"
siete_btn.num_txt.text="7"
ocho_btn.num_txt.text="8"
nueve_btn.num_txt.text="9"
cero_btn.num_txt.text="0"
backdelete_btn.addEventListener(MouseEvent.MOUSE_DOWN, back);
var micampo:Array= new Array();
var contador:Number=0
var miTeclado:Array= new Array();
function Action (e:MouseEvent):void
{
var selec:Object= new Object();
selec= e.currentTarget;
switch(selec){
case uno_btn:
campo_txt.appendText("1"),
addInArray("1"),e.currentTarget.gotoAndStop(3)
break;
case dos_btn:
campo_txt.appendText("2"),
addInArray("2"),e.currentTarget.gotoAndStop(3)
break;
case tres_btn:
campo_txt.appendText("3")
addInArray("2");e.currentTarget.gotoAndStop(3)
break;
case cuatro_btn:
campo_txt.appendText("4")
addInArray("2");e.currentTarget.gotoAndStop(3)
break;
case cinco_btn:
campo_txt.appendText("5")
addInArray("5");e.currentTarget.gotoAndStop(3)
break;
case seis_btn:
campo_txt.appendText("6")
addInArray("6");e.currentTarget.gotoAndStop(3)
break;
case siete_btn:
campo_txt.appendText("7")
addInArray("7");e.currentTarget.gotoAndStop(3)
break;
case ocho_btn:
campo_txt.appendText("8")
addInArray("2");e.currentTarget.gotoAndStop(3)
break;
case nueve_btn:
campo_txt.appendText("9")
addInArray("2");e.currentTarget.gotoAndStop(3)
break;
case cero_btn:
campo_txt.appendText("0")
addInArray("0");e.currentTarget.gotoAndStop(3)
break;
}
}
function EndAction (e:MouseEvent):void
{
e.currentTarget.gotoAndStop(1)
}
function addInArray(dat):void{micampo[contador]= dat;contador++;}
function back(e:MouseEvent):void
{
campo_txt.text=""
for ( var i=0; i < micampo.length-1 ; i++ ){ campo_txt.appendText(micampo[i]) }
micampo.pop();
contador--
if (contador <= 0) contador =0;
}
Ingeniatelas, no sera problema en agregarle todas las teclas incluyendo tab shift etx