Bind Data To Model
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF" width="550" height="300"> <mx:Script> import mx.controls.Alert; private function modelToString():void{ Alert.show(contactmodel.fname + " " + contactmodel.lname + "\n" + contactmodel.address + "\n" + contactmodel.city + " " + contactmodel.state + " " + contactmodel.zip + "\n" + contactmodel.phone + "\n" +contactmodel.email,"contactmodel"); } </mx:Script> <mx:Model id="contactmodel"> <contact> <fname>{fnametxt.text}</fname> <lname>{lnametxt.text}</lname> <address>{addresstxt.text}</address> <city>{citytxt.text}</city> <state>{statetxt.text}</state> <zip>{ziptxt.text}</zip> <phone>{phonetxt.text}</phone> <email>{emailtxt.text}</email> </contact> </mx:Model> <mx:Panel title="Contact Info" width="500" height="250"> <mx:Form> <mx:FormItem label="Name" direction="horizontal"> <mx:TextInput id="fnametxt" /> <mx:TextInput id="lnametxt" /> </mx:FormItem> <mx:FormItem label="Address"> <mx:TextInput id="addresstxt"/> </mx:FormItem> <mx:FormItem label="City State, Zip" direction="horizontal"> <mx:TextInput id="citytxt"/> <mx:TextInput id="statetxt" width="20"/> <mx:TextInput id="ziptxt" width="50"/> </mx:FormItem> <mx:FormItem label="Phone"> <mx:TextInput id="phonetxt"/> </mx:FormItem> <mx:FormItem label="Email"> <mx:TextInput id="emailtxt"/> </mx:FormItem> <mx:Button click="modelToString()" label="Show Model Data"/> </mx:Form> </mx:Panel> </mx:Application>