flash 屏蔽中文输入


var reg:RegExp=/[\u4e00-\u9fa5]/g;

var myText:TextField=new TextField();
myText.border=true;
myText.type=flash.text.TextFieldType.INPUT;
myText.multiline=true;
myText.wordWrap=true;

myText.addEventListener(Event.CHANGE,changeHandler);
myText.x=myText.y=100;
addChild(myText);

function changeHandler(evt:Event):void {
    var target:TextField=evt.currentTarget as TextField;   
    var s:String=target.text;
    target.text=s.replace(reg,"");
}

你可能感兴趣的:(Flash)