Create and invoke a validator programmatically in when a user clicks a Button control
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import mx.validators.ZipCodeValidator; private var v:ZipCodeValidator = new ZipCodeValidator(); private function performValidation():void { v.domain = "US or Canada"; v.listener=myZip; v.validate(myZip.text); } </mx:Script> <mx:TextInput id="myZip" /> <mx:Button label="Submit" click="performValidation();" /> </mx:Application>