var tf:TextField = new TextField();
public function Main()
{
tf.addEventListener(KeyboardEvent.KEY_DOWN, onkeydown);
addChild(tf);
}
private function onkeydown(e:Event):void
{
if (tf.text.charAt(0) == "0")
{
//Create an alert, snip the text field, cause a stackovereflow.
//Maybe hack the computer for bitcoins just because.
}
}
1条答案
按热度按时间kfgdxczn1#
如果charCode(0)是零,你能得到文本字段并执行一个条件where吗?