Model data and form controls
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Model id="reg"> <registration> <name>{username.text}</name> <email>{email.text}</email> <phone>{phone.text}</phone> <zip>{zip.text}</zip> <ssn>{ssn.text}</ssn> </registration> </mx:Model> <mx:Validator required="true" source="{reg}" property="name" trigger="{submit}" triggerEvent="click" listener="{username}" /> <mx:EmailValidator source="{reg}" property="email" trigger="{submit}" triggerEvent="click" listener="{email}" /> <mx:PhoneNumberValidator source="{reg}" property="phone" trigger="{submit}" triggerEvent="click" listener="{phone}" /> <mx:ZipCodeValidator source="{reg}" property="zip" trigger="{submit}" triggerEvent="click" listener="{zip}" /> <mx:SocialSecurityValidator source="{reg}" property="ssn" trigger="{submit}" triggerEvent="click" listener="{ssn}" /> <mx:Form> <mx:FormItem label="Name" required="true"> <mx:TextInput id="username" width="200" /> </mx:FormItem> <mx:FormItem label="Email" required="true"> <mx:TextInput id="email" width="200" /> </mx:FormItem> <mx:FormItem label="Phone" required="true"> <mx:TextInput id="phone" width="200" /> </mx:FormItem> <mx:FormItem label="Zip" required="true"> <mx:TextInput id="zip" width="60" /> </mx:FormItem> <mx:FormItem label="Social Security" required="true"> <mx:TextInput id="ssn" width="200" /> </mx:FormItem> <mx:FormItem> <mx:Button id="submit" label="Validate" /> </mx:FormItem> </mx:Form> </mx:Application>