The application dispatches HTTPStatusEvent objects when a network request returns an HTTP status code.

HTTPStatusEvent objects are always sent before error or completion events. An HTTPStatusEvent object does not necessarily indicate an error condition; it simply reflects the HTTP status code(if any) that is provided by the networking stack. Some Flash Player environments may be unable to detect HTTP status codes; a status code of 0 is always reported in these cases.

In Flash Player, there is only one type of HTTPStatus event: httpStatus. In the AIR runtime, a FileReference, URLLoader, or URLStream can register to listen for an httpResponseStatus, which includes responseURL and responseHeaders properties. These properties are undefined in a httpStatus event.

Constructor

new (type:String, bubbles:Bool = false, cancelable:Bool = false, status:Int = 0, redirected:Bool = false)

Creates an Event object that contains specific information about HTTP status events. Event objects are passed as parameters to event listeners.

Parameters:

type

The type of the event. Event listeners can access this information through the inherited type property. There is only one type of HTTPStatus event: HTTPStatusEvent.HTTP_STATUS.

bubbles

Determines whether the Event object participates in the bubbling stage of the event flow. Event listeners can access this information through the inherited bubbles property.

cancelable

Determines whether the Event object can be canceled. Event listeners can access this information through the inherited cancelable property.

status

Numeric status. Event listeners can access this information through the status property.

Variables

responseHeaders:Array<URLRequestHeader>

The response headers that the response returned, as an array of URLRequestHeader objects.

responseURL:String

The URL that the response was returned from. In the case of redirects, this will be different from the request URL.

read onlystatus:Int

The HTTP status code returned by the server. For example, a value of 404 indicates that the server has not found a match for the requested URI. HTTP status codes can be found in sections 10.4 and 10.5 of the HTTP specification at [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).

If Flash Player or AIR cannot get a status code from the server, or if it cannot communicate with the server, the default value of 0 is passed to your code. A value of 0 can be generated in any player(for example, if a malformed URL is requested), and a value of 0 is always generated by the Flash Player plug-in when it is run in the following browsers, which do not pass HTTP status codes to the player: Netscape, Mozilla, Safari, Opera, and Internet Explorer for the Macintosh.

Static variables

staticinline read onlyHTTP_RESPONSE_STATUS:String = "httpResponseStatus"

Unlike the httpStatus event, the httpResponseStatus event is delivered before any response data. Also, the httpResponseStatus event includes values for the responseHeaders and responseURL properties (which are undefined for an httpStatus event. Note that the httpResponseStatus event(if any) will be sent before(and in addition to) any complete or error event.

The HTTPStatusEvent.HTTP_RESPONSE_STATUS constant defines the value of the type property of a httpResponseStatus event object.

This event has the following properties:

staticinline read onlyHTTP_STATUS:String = "httpStatus"

The HTTPStatusEvent.HTTP_STATUS constant defines the value of the type property of a httpStatus event object.

This event has the following properties:

Inherited Variables

Defined by Event

read onlybubbles:Bool

Indicates whether an event is a bubbling event. If the event can bubble, this value is true; otherwise it is false.

When an event occurs, it moves through the three phases of the event flow: the capture phase, which flows from the top of the display list hierarchy to the node just before the target node; the target phase, which comprises the target node; and the bubbling phase, which flows from the node subsequent to the target node back up the display list hierarchy.

Some events, such as the activate and unload events, do not have a bubbling phase. The bubbles property has a value of false for events that do not have a bubbling phase.

read onlycancelable:Bool

Indicates whether the behavior associated with the event can be prevented. If the behavior can be canceled, this value is true; otherwise it is false.

read onlycurrentTarget:Any

The object that is actively processing the Event object with an event listener. For example, if a user clicks an OK button, the current target could be the node containing that button or one of its ancestors that has registered an event listener for that event.

read onlyeventPhase:EventPhase

The current phase in the event flow. This property can contain the following numeric values:

  • The capture phase(EventPhase.CAPTURING_PHASE).
  • The target phase(EventPhase.AT_TARGET).
  • The bubbling phase(EventPhase.BUBBLING_PHASE).

read onlytarget:Any

The event target. This property contains the target node. For example, if a user clicks an OK button, the target node is the display list node containing that button.

read onlytype:String

The type of event. The type is case-sensitive.

Inherited Methods

Defined by Event

clone ():Event

Duplicates an instance of an Event subclass.

Returns a new Event object that is a copy of the original instance of the Event object. You do not normally call clone(); the EventDispatcher class calls it automatically when you redispatch an event - that is, when you call dispatchEvent(event) from a handler that is handling event.

The new Event object includes all the properties of the original.

When creating your own custom Event class, you must override the inherited Event.clone() method in order for it to duplicate the properties of your custom class. If you do not set all the properties that you add in your event subclass, those properties will not have the correct values when listeners handle the redispatched event.

In this example, PingEvent is a subclass of Event and therefore implements its own version of clone().

Returns:

A new Event object that is identical to the original.

formatToString (className:String, ?p1:Dynamic, ?p2:Dynamic, ?p3:Dynamic, ?p4:Dynamic, ?p5:Dynamic):String

isDefaultPrevented ():Bool

Checks whether the preventDefault() method has been called on the event. If the preventDefault() method has been called, returns true; otherwise, returns false.

Returns:

If preventDefault() has been called, returns true; otherwise, returns false.

preventDefault ():Void

Cancels an event's default behavior if that behavior can be canceled. Many events have associated behaviors that are carried out by default. For example, if a user types a character into a text field, the default behavior is that the character is displayed in the text field. Because the TextEvent.TEXT_INPUT event's default behavior can be canceled, you can use the preventDefault() method to prevent the character from appearing. An example of a behavior that is not cancelable is the default behavior associated with the Event.REMOVED event, which is generated whenever Flash Player is about to remove a display object from the display list. The default behavior (removing the element) cannot be canceled, so the preventDefault() method has no effect on this default behavior. You can use the Event.cancelable property to check whether you can prevent the default behavior associated with a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event; otherwise, preventDefault() has no effect.

stopImmediatePropagation ():Void

Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow. This method takes effect immediately, and it affects event listeners in the current node. In contrast, the stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing.

Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.

stopPropagation ():Void

Prevents processing of any event listeners in nodes subsequent to the current node in the event flow. This method does not affect any event listeners in the current node(currentTarget). In contrast, the stopImmediatePropagation() method prevents processing of event listeners in both the current node and subsequent nodes. Additional calls to this method have no effect. This method can be called in any phase of the event flow.

Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.

toString ():String

Returns a string containing all the properties of the Event object. The string is in the following format:

[Event type=_value_ bubbles=_value_ cancelable=_value_]

Returns:

A string containing all the properties of the Event object.