Search code examples
actionscript-3haxeurlloader

Get location from the URLLoader?


How to get location from the URLLoader in AS3 or haxe?

What I have:

private function Auth():Void {
    _url = "https://my_url.com";        
    request = new URLRequest(_url);
    request.method = URLRequestMethod.POST;     
    var loader:URLLoader = new URLLoader();
    loader.load(request);
    loader.addEventListener(Event.COMPLETE, fAuthAnswer);               
}
private function fAuthAnswer(e:Event):Void {
    trace(e.target.data);
}

And when the event is complete, i see the HTML code of the loaded page. But I need to get a loaded URL, because site is redirected me and add auth information in URL. And i need to get it.

Help, please :)

PS I use haxe, so in my way I can't use stagewebview. PPS Sorry for my English.


Solution

  • Listen for flash.events.HTTPStatusEvent http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#event:httpResponseStatus. It has a property responseURL.