Skip navigation
Currently Being Moderated

an URLRequest url Problem or a Flash as3 bug?

Apr 23, 2012 12:16 AM

Tags: #problem #script #as3 #3.0 #action #action_script_3 #as3.0 #ac3 #actionscript3 #actionscript_3.0 #request #urlrequest

hi, guys

 

I'm working with a Flash based HLS player. I am unable to locate a redirect url while the request server response a 302 redirect code.

is this a bug in Flash AS3 ?

 

var url:String = "http://aaa.company.com/xxxx"; (response a 302 code and redirect to http://bbb.company.com/yyyy)

var req:URLRequest = new URLRequest(url);

var dispatcher:URLLoader = new URLLoader(req);

dispatcher.addEventListener(Event.COMPLETE, handlefunction);

 

function handlefunction(event:Event):void

{

     trace(req.url); 

     // the console outputs  "http://aaa.company.com/xxxx"

     // or trace((event.currentTarget as URLRequest).url); the output is same.

     // it should be "http://bbb.company.com/yyyy"

     // but the event.currentTarget.data is ok.

     // so how can I get the new url ?

     // is this a bug in flash as3?

}

 

thanks.

 
Replies
  • Currently Being Moderated
    Apr 23, 2012 1:19 AM   in reply to michael gao

    You are tracing out the url of the request and it's still what you set it to. The request to load will not change the request.

     

    I haven't tried doing this myself but you could try looking at the HTTPStatusEvent dispatches by the load function this has a responseHeaders property which might contain the redirected url?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 23, 2012 2:54 AM   in reply to michael gao

    I'd not tried it myself it was just an idea, and it shouldn't matter it can catch the 302 or not on receiving the 200 status you hould still be able to see an event and therefore the response headers i was just hoping that it would contain the redirected url but here it is null.

     

    maybe you have to set up a custom URLRequestHeader but I again I have no idea if that would work.

     

    is there any particular reason you need to redirected url?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points