/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private function subscribeEmail():void { // submit form var req:URLRequest = new URLRequest( _model.frameworkGateway ); var vars:URLVariables = new URLVariables( ); var proxy:URLLoader = new URLLoader( ); vars.action = "subscribe"; vars.email = _emailField.text; req.data = vars; req.method = URLRequestMethod.POST; proxy.addEventListener( Event.COMPLETE , subscribeComplete ); proxy.addEventListener( IOErrorEvent.IO_ERROR , ioError ); proxy.load( req ); // sendToURL( req) } private function subscribeComplete(evt:Event):void { var content:String = evt.target.data; var strippedContent:Array = content.split( "res=" ); _errorText.text = strippedContent[1]; } private function ioError(io:IOErrorEvent):void { Logger.info( "RESULT: " + io.target.data.res ); _errorText.text = "Could not subscribe"; }