<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.ResultEvent public function sendEmail( ):void { var senderName:String = senderName.text; var senderEmail:String = senderEmail.text; var sendToName:String = sendToName.text; var sendToEmail:String = sendToEmail.text; var emailMessage:String = emailMessage.text; this.emailService.send({senderName: senderName, senderEmail:senderEmail, sendToName: sendToName, sendToEmail: sendToEmail, emailMessage: emailMessage}); if (cb.selected == true) { this.emailService.send({senderName: senderName, senderEmail:senderEmail, sendToName: sendToName, sendToEmail: senderEmail, emailMessage: emailMessage}); } } public function emailResult():void { Alert.show("Email Has Been Sent"); this.submitBtn.enabled = false; } ]]> </mx:Script> <mx:Style source="css/augieMarcelloStyle.css" /> <mx:HTTPService id="emailService" url="http://www.examples.augiemarcello.com/Flex2/SimpleEmailForm/php/email.php" method="POST" resultFormat="xml" result="emailResult()" useProxy="false"/> <mx:Panel width="450" height="459" > <mx:Text width="100%" height="29" text="Simple Email Form" styleName="header"/> <mx:Text text="Adobe FLEX 2.0 / ActionScript 3 / PHP" styleName="subHeader" /> <mx:HRule width="100%"/> <mx:Form id="emailForm" width="100%" > <mx:FormItem label="Your Name:" horizontalAlign="left" width="100%"> <mx:TextInput id="senderName" width="100%"/> </mx:FormItem> <mx:FormItem label="Your E-mail:" width="100%"> <mx:TextInput id="senderEmail" width="100%"/> </mx:FormItem> <mx:FormItem label="Friends Name:" horizontalAlign="left" width="100%"> <mx:TextInput id="sendToName" width="100%"/> </mx:FormItem> <mx:FormItem label="Friends E-mail:" width="100%"> <mx:TextInput id="sendToEmail" width="100%"/> </mx:FormItem> <mx:FormItem label="Message" horizontalAlign="left" width="100%"> <mx:TextArea id="emailMessage" width="100%" height="100"/> </mx:FormItem> <mx:FormItem width="100%"> <mx:Spacer width="200" /> <mx:Button id="submitBtn" label="Submit" click="this.sendEmail();" /> </mx:FormItem> </mx:Form> <mx:HBox styleName="cbStyle"> <mx:CheckBox label="Check to send a copy to yourself" id="cb"/> </mx:HBox> <mx:HRule width="100%"/> <mx:Label styleName="footer"> <mx:htmlText><![CDATA[<a href="http://www.augiemarcello.com" target="_blank" ><b>www.augiemarcello.com</b></a>]]></mx:htmlText> </mx:Label> </mx:Panel> </mx:Application>