Test touches avec Mtasc

appuyer sur les fleches pour déplacer la boule

fichiers zippés

fichier batch
touche.bat:
E:\mtasc\mtasc -swf E:\mtasc\touche\touche.swf -main touche.as

 

fichier phi
un groupe 'carre' avec un bouton test:

->mesfonctions:touche();

 

fichier touche.as
class mesfonctions{
static function touche(){
_root.message_text ="Attente touche..";
var touche,Points_x,Points_y:Number;
Points_x=_root.boule._x;
Points_y=_root.boule._y;
var keyListener:Object = new Object();
keyListener.onKeyDown = function(){

_root.message_text ="Vous avez appuyez";
_root.message1_text ="Code Ascii: "+chr(Key.getAscii());
_root.message2_text ="Code toute touche: "+Key.getCode();
touche = Key.getCode();
if (touche == 38 ) { //fleche haut
touche=0; Points_y=Points_y-1; }
if (touche == 40 ) { // fleche bas
touche=0; Points_y=Points_y+1; }
if (touche == 37 ) { //fleche gauche
touche=0; Points_x=Points_x-1; }
if (touche == 39 ) { // fleche droite
touche=0; Points_x=Points_x+1; }
_root.axex_text = _root.boule._x;_root.axey_text =_root.boule._y;
_root.boule._x=Points_x;
_root.boule._y=Points_y;

}
keyListener.onKeyUp = function(){
_root.message_text ="Vous avez relachez";
_root.message1_text ="Code Ascii: "+chr(Key.getAscii());
_root.message2_text ="Code toute touche: "+Key.getCode();
}
Key.addListener(keyListener);
}
static function main() { }
}