flash on 2010-2-18

by hacker_u_yjm2r7
♥0 | Line 53 | Modified 2010-02-18 18:57:48 | MIT License
play

ActionScript3 source code

/**
 * Copyright hacker_u_yjm2r7 ( http://wonderfl.net/user/hacker_u_yjm2r7 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/chAp
 */

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="280" height="280">
	<mx:states>
		<mx:State name="thanks">
			<mx:RemoveChild target="{name_label}"/>
			<mx:RemoveChild target="{username}"/>
			<mx:RemoveChild target="{email_label}"/>
			<mx:RemoveChild target="{email}"/>
			<mx:RemoveChild target="{msg}"/>
			<mx:RemoveChild target="{message_label}"/>
			<mx:RemoveChild target="{send_btn}"/>
			<mx:AddChild relativeTo="{main}" position="lastChild">
				<mx:Text x="38" y="118" text="Thanks for your contact us !" fontSize="14"/>
			</mx:AddChild>
		</mx:State>
	</mx:states>
<mx:HTTPService id="contactService" url="contact.php" result="thanks(event)" contentType="application/x-www-form-urlencoded" method="POST" resultFormat="text">
	<mx:request xmlns="">		
		<name>{username.text}</name>
		<email>{email.text}</email>
		<msg>{msg.text}</msg>
	</mx:request>
</mx:HTTPService>
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			private function sendInfo():void{
				if(username.text=="" || email.text=="" || msg.text==""){
					mx.controls.Alert.show("Please verify your form!")
				} else {
					 contactService.send()
				}
			}
			private function thanks(evt:Event):void{
				if(String(contactService.lastResult)=="ok") currentState = "thanks"
				else mx.controls.Alert.show("Errors sending email!")
			}
		]]>
	</mx:Script>
<mx:Canvas width="280" height="280" id="main">	
	<mx:Label x="53" y="20" text="Please leave your message" id="title" color="#0B333C" fontWeight="bold" fontSize="12"/>
	<mx:Label x="40" y="75" text="Name" id="name_label"/>
	<mx:Label x="42" y="112" text="Email" id="email_label"/>
	<mx:Label x="23" y="148" text="Message" id="message_label"/>
	<mx:TextInput x="85" y="73" id="username"/>
	<mx:TextInput x="85" y="110" id="email"/>
	<mx:TextArea x="85" y="147" id="msg" height="70"/>
	<mx:Button x="124" y="235" label="Send" id="send_btn" click="sendInfo()"/>
</mx:Canvas>
	<mx:Validator id="nameValidator" source="{username}" property="text" required="true" requiredFieldError="Name field is mandatory"/>
	<mx:EmailValidator id="mailValidator" source="{email}" property="text" required="true" requiredFieldError="Email is mandatory" />
	<mx:Validator id="msgValidator" source="{msg}" property="text" required="true" requiredFieldError="Please write a message" />
</mx:Application>

Forked