this is my code ..
import RegExp;
var userEmail:String;
var us开发者_如何学GoerName:String;
var userPhone:String;
how to restrict my userPhone:String; to take only numbers?
i tried the restrict property. the compiler gives me error.
In ActionScript 2, the TextField.restrict property takes a String which represents a regExp like character range.
Here's a quick example of how to limit an input textfield to numbers only:
var phoneNumberLabel : TextField = createTextField("phoneNumberLabel", 1, 20, 20, 80, 20);
phoneNumberLabel.text = "Phone Number:";
var phoneNumberField : TextField = createTextField("phoneNumberField", 2, 110, 20, 200, 20);
phoneNumberField.type = "input";
phoneNumberField.border = true;
phoneNumberField.restrict = "0-9";
精彩评论