使用Number将字符串转换为数字,然后isNaN检查结果是否为数字:
var str:String="1234";
var n:Number = Number(str);
if (isNaN(n)) {
trace(str+" is not a number");
} else {
trace(str+" is a number");
}
str="12a4";
n=Number(str);
if (isNaN(n)) {
trace(str+" is not a number");
} else {
trace(str+" is a number");
}