
FLASH AS3.0 里 怎么使输入文本框里 只输入数字 下面是我的代码 让t3.text 只能输入数字
t1.text=String(Math.round(Math.random()*100));t2.text=String(Math.round(Math.random()...
t1.text = String(Math.round(Math.random ()*100));
t2.text = String(Math.round(Math.random ()*100));
function jx(event:Object){
if ((int(t1.text)+int(t2.text))==int(t3.text)){
t4.text = "正确";
}else{
t4.text = "错误";
}
}
bt1.addEventListener("click",jx);
function jx1(event:Object){
t1.text = String(Math.round(Math.random ()*100));
t2.text = String(Math.round(Math.random ()*100));
t3.text = String("");
t4.text = String("");
}
bt2.addEventListener("click",jx1); 展开
t2.text = String(Math.round(Math.random ()*100));
function jx(event:Object){
if ((int(t1.text)+int(t2.text))==int(t3.text)){
t4.text = "正确";
}else{
t4.text = "错误";
}
}
bt1.addEventListener("click",jx);
function jx1(event:Object){
t1.text = String(Math.round(Math.random ()*100));
t2.text = String(Math.round(Math.random ()*100));
t3.text = String("");
t4.text = String("");
}
bt2.addEventListener("click",jx1); 展开
展开全部
restrict获取或设置文本字段从用户处接受的字符串。 请注意,未包含在本字符串中的以编程方式输入的字符也为文本字段所接受。
字符串中字符的读取顺序为从左到右。 可以使用连字符 (-) 指定一个字符范围。
如果此属性的值为 null,则文本字段会接受所有字符。 如果此属性设置为空字符串 (""),则文本字段不接受任何字符。
t3.restrict="0-9"
字符串中字符的读取顺序为从左到右。 可以使用连字符 (-) 指定一个字符范围。
如果此属性的值为 null,则文本字段会接受所有字符。 如果此属性设置为空字符串 (""),则文本字段不接受任何字符。
t3.restrict="0-9"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询