键盘登录,as3

时间:2010-07-20 17:12:48

标签: flash actionscript-3

如何使其更像登录, 文本字段接受数字并输入的位置? 谢谢你的帮助,

var login:int = 0;
//KEYPAD LISTENERS
num1.addEventListener(MouseEvent.CLICK, num1b);
num2.addEventListener(MouseEvent.CLICK, num2b);
//...
//KEYPAD FUNCTION
function num1b(e:MouseEvent):void{
login = 1;
trace(login);
tx.text = String(login);
}
function num2b(e:MouseEvent):void{
login = 2;
trace(login);
tx.text = String(login);
}
//CAN ENTER SITE
addEventListener(Event.ENTER_FRAME, entry);
function entry(evt:Event):void{
if(login == 528){
//gotoAndPlay();        
}
}

我正在制作键盘以登录Flash网站并查看投资组合。该 如果没有递增或,则值不会进入动态文本字段 互相覆盖。

试过这个

//numb1b
tx.text = tx.text + "1"; 
//numb2b
tx.text = tx.text + "2"; 

1 个答案:

答案 0 :(得分:1)

不使用数字,而是使用字符串/字符:

var login:String = "";
//KEYPAD LISTENERS
num1.addEventListener(MouseEvent.CLICK, num1b);
num2.addEventListener(MouseEvent.CLICK, num2b);
//...
//KEYPAD FUNCTION
function num1b(e:MouseEvent):void{
login = login + "1";
trace(login);
tx.text = login;
}
function num2b(e:MouseEvent):void{
login = login + "2";
trace(login);
tx.text = login;
}
//CAN ENTER SITE
addEventListener(Event.ENTER_FRAME, entry);
function entry(evt:Event):void{
if(login == "528"){
//gotoAndPlay();        
}
}