0

Keeping into consideration the Actionscript 3 event HTTPStatusEvent:HTTP_RESPONSE_STATUS, which is ONLY AVAILABLE for AIR (and not Flash 9/10)

Quote from site:

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Lite 4

I would like to add the same EVENT by extending the HTTPStatusEvent Class of Actionscript 3 for Flash (9/10).

I'm working on Adobe Flash CS3 and I'm trying to get the "last" location of a URL loader (I'm calling a php with a header("Location: ..."); ) so I need the location after it changes. This should be made directly by flash and I cannot use php proxies not other.

Also, I cannot find the source code of the AIR HTTPStatusEvent Class, which I need to get the event (specifically, the responseHeaders and responseURL properties that the AIR class has).

Of course, if you know of any other way to accomplish this, feel free to share it.

Dandy
  • 303
  • 5
  • 14

1 Answers1

0

You can't do it this way.

Think about it: You are trying to add behavior to the URLLoader class by extending an event class that is thrown from there. Figuratively speaking, it's a bit like changing the paper size when you've only written letters to your next door neighbor, and now you want them to go overseas - unless you also give them to the mail main, that's not going to be very successful...

I've stumbled across a number of forum threads discussing this, and most of them seem to agree that Adobe prevented access to response headers in Flash versions prior to FP10 / AIR due to some sort of security issue. I'm not sure how much of this information is accurate, but I am quite confident that there is no way to get around this - you can't get the Location:header in older Flash versions.

You will have to find some other workaround. For example, if you have access to the PHP script, you could add an HTML comment containing the redirect location, and parse that value in ActionScript.

<!-- Location: http://google.com/ -->
weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
  • Thanks. I don't have access to the script. Anyway, how should I approach to the mission of extending a general class (using the example I need won't be bad at all)? I'll play around with it. – Dandy Jan 03 '12 at 01:42
  • You can extend any of the general classes without any problems. It's just that URLLoader provides interfaces to the "outside world", and that's basic functionality of the Flash Player - you can override existing methods and do all sorts of stuff with what's already there, but there is just no way to add new functionality to the core API. – weltraumpirat Jan 03 '12 at 02:36