The URLRequest
and URLLoader
classes work together to make requests from Flash to external resources. The URLRequest
defines information about the request e.g. the request body and the request method type, and the URLLoader
references this to perform the actual request and provide a means of being notified when a response is received from the resource.
Example:
var request:URLRequest = new URLRequest('http://stackoverflow.com');
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, responseReceived);
loader.load(request);
function responseReceived(event:Event):void {
trace(event.target.data); // or loader.data if you have reference to it in
// this scope.
}