24 April 2006

Code:Flash Lite 2. 0 AS2 Key "catcher" code

Here is an example code how Hayden Porter currently handling key down events.

His main concern is whether using the following code for detecting 12
digit key presses will work on international phones.

String.fromCharCode(Key.getAscii())

I am assuming this should convert the ASCII code into, the physical
label printed on a given key such as 1-9,0#,*.

/*
Define key DOWN events
*/
var keyListener:Object = new Object();
keyListener.onfiltered= function() {
// for 5 way navigation and soft key down events
switch(Key.getCode()){
case Key.ENTER: my_txt.text = "enter"; break;
case Key.LEFT: my_txt.text = "left"; break;
case Key.RIGHT: my_txt.text = "right"; break;
case Key.UP: my_txt.text = "up"; break;
case Key.DOWN: my_txt.text = "down"; break;
case ExtendedKey.SOFT1: my_txt.text = "left soft key"; break;
case ExtendedKey.SOFT2:
my_txt.text = "right soft key";
fscommand2("Quit");
break;
}

// for 12 digit keypad key down events
switch(String.fromCharCode(Key.getAscii())){
case "1": my_txt.text = "1";break;
case "2": my_txt.text = "2";break;
case "3": my_txt.text = "3";break;
case "4": my_txt.text = "4";break;
case "5": my_txt.text = "5";break;
case "6": my_txt.text = "6";break;
case "7": my_txt.text = "7";break;
case "8": my_txt.text = "8";break;
case "9": my_txt.text = "9";break;
case "0": my_txt.text = "0";break;
case "*": my_txt.text = "*";break;
case "#": my_txt.text = "#";break;
}
};
Key.addListener(keyListener);

PPL IAIN Syekh Nurjati Cirebon

Jika ditanya apa yang kau suka dari kehadiran mereka? Mereka punya jawabannya : semangat yang tinggi dengan keingintahuan yang tipikal mahas...