Skip to content

Instantly share code, notes, and snippets.

@haigopi
Created August 1, 2018 03:06
Show Gist options
  • Save haigopi/19b9bfde7bf0fe165a328c612a2655e7 to your computer and use it in GitHub Desktop.
Save haigopi/19b9bfde7bf0fe165a328c612a2655e7 to your computer and use it in GitHub Desktop.
Example of HTTP exchange inside action script.
package allibilliHTTP
{
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
public class HttpUtil
{
public var http:HTTPService=new HTTPService();
//private static var serverURL:String="http://localhost:8080/AlliBilli/";
private static var serverURL:String="http://services.allibilli.com/xml/";
public function HttpUtil()
{
}
public function sendRequest(URL:String, handler:Function):void
{
http.url=serverURL + URL;
http.resultFormat="e4x";
http.method="POST";
trace(http.url);
http.addEventListener(ResultEvent.RESULT, handler);
http.send();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment