ActionScript Code:
/************************************** Developed by Anil kumar N D anilkumarnd@gmail.com http://flash-workshop.blogspot.com/ http://flash-workshop.com/ Flash CS4 professional ActionScript 3.0 06 July,2010 **************************************/ package { import flash.display.MovieClip; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.net.URLVariables; import flash.events.Event; import flash.events.MouseEvent; public class main extends MovieClip{ private var ldr_receive:URLLoader; private var ldr_send:URLLoader; private var url_variables:URLVariables; private var xml_obj:XML; private var int_counter:int; private var urlRequest:URLRequest; /*********************************************************************************************** Default constructor ************************************************************************************************/ public function main():void { mc_ctrls.visible = false; txt_msgs.text = "Loading"; ldr_receive = new URLLoader ; ldr_receive.addEventListener(Event.COMPLETE,fn_serverResponse); ldr_receive.load(new URLRequest("getData.php")); mc_btn.mouseChildren = false; mc_btn.buttonMode = true; mc_btn.addEventListener(MouseEvent.CLICK,fn_mc_btnClickHandler); mc_ctrls.mc_send.mouseChildren = false; mc_ctrls.mc_send.buttonMode = true; mc_ctrls.mc_send.addEventListener(MouseEvent.CLICK,fn_mc_sendClickHandler); mc_ctrls.mc_cancel.mouseChildren = false; mc_ctrls.mc_cancel.buttonMode = true; mc_ctrls.mc_cancel.addEventListener(MouseEvent.CLICK,fn_mc_sendClickHandler); } /*********************************************************************************************** ************************************************************************************************/ private function fn_mc_sendClickHandler(IN_Event:Event):void { mc_ctrls.visible = false; txt_msgs.visible = true; mc_btn.visible = true; switch(true){ case(IN_Event.target.name == "mc_send" && (mc_ctrls.txt_name.text != "" && mc_ctrls.txt_email.text != "" && mc_ctrls.txt_msg.text != "")): urlRequest = new URLRequest("update.php"); url_variables = new URLVariables(); url_variables.name = mc_ctrls.txt_name.text; url_variables.email = mc_ctrls.txt_email.text; url_variables.message = mc_ctrls.txt_msg.text; urlRequest.method=URLRequestMethod.POST; urlRequest.data=url_variables; ldr_send = new URLLoader(); ldr_send.addEventListener(Event.COMPLETE, fn_serverResponse2); ldr_send.load(urlRequest); break; case(IN_Event.target.name == "mc_cancel"): trace("do something"); break; } } /*********************************************************************************************** ************************************************************************************************/ private function fn_serverResponse2(IN_Event:Event):void { ldr_receive.load(new URLRequest("getData.php")); } /*********************************************************************************************** ************************************************************************************************/ private function fn_mc_btnClickHandler(IN_Event:Event):void { mc_ctrls.visible = true; txt_msgs.visible = false; mc_btn.visible = false; mc_ctrls.txt_name.text = ""; mc_ctrls.txt_email.text = ""; mc_ctrls.txt_msg.text = ""; } /*********************************************************************************************** ************************************************************************************************/ private function fn_serverResponse(IN_Event:Event):void { txt_msgs.text = ""; url_variables = new URLVariables(IN_Event.target.data); xml_obj = new XML(String(url_variables.dataFromPhp)); int_counter = xml_obj.Visitor.length(); for each (var item:XML in xml_obj..Visitor) { txt_msgs.appendText("MSG: "); txt_msgs.appendText(String(int_counter--)); txt_msgs.appendText("\n"); txt_msgs.appendText(item.Message); txt_msgs.appendText("\n"); txt_msgs.appendText(""); txt_msgs.appendText(item.Name); txt_msgs.appendText("\n"); txt_msgs.appendText(item.ip); txt_msgs.appendText("\n"); txt_msgs.appendText(item.Date); txt_msgs.appendText("\n--------------------------------------------------------------------------------------\n"); } } } }
Comments
Flash Web Developer
I don't dowload your link because our country don't below 4shared.com
if you upload rapidshare or other..
thanks