| Package | flash.events |
| Class | public class NetStatusEvent |
| Inheritance | NetStatusEvent Event Object |
NetStatusEvent.NET_STATUS.
See also
| Property | Defined by | ||
|---|---|---|---|
![]() | bubbles : Boolean
Indicates whether an event is a bubbling event.
| Event | |
![]() | cancelable : Boolean
Indicates whether the behavior associated with the event can be prevented.
| Event | |
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance.
| Object | |
![]() | currentTarget : Object
The object that is actively processing the Event object with an event listener.
| Event | |
![]() | eventPhase : uint
The current phase in the event flow.
| Event | |
| info : Object
An object with properties that describe the object's status or error condition.
| NetStatusEvent | ||
![]() | prototype : Object
[static]
A reference to the prototype object of a class or function object.
| Object | |
![]() | target : Object
The event target.
| Event | |
![]() | type : String
The type of event.
| Event | |
| Method | Defined by | ||
|---|---|---|---|
|
NetStatusEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, info:Object = null)
Creates an Event object that contains information about
netStatus events. | NetStatusEvent | ||
|
Creates a copy of the NetStatusEvent object and sets the value of each property to match that of the original.
| NetStatusEvent | ||
![]() |
A utility function for implementing the
toString() method in your custom Event class. | Event | |
![]() |
Checks whether
preventDefault() has been called on the event. | Event | |
![]() |
preventDefault():void
Cancels an event's default behavior if that behavior can be canceled.
| Event | |
![]() |
Sets the availability of a dynamic property for loop operations.
| Object | |
![]() |
stopImmediatePropagation():void
Prevents processing of any event listeners in the current node and any subsequent nodes in
the event flow.
| Event | |
![]() |
stopPropagation():void
Prevents processing of any event listeners in nodes subsequent to the current node in the
event flow.
| Event | |
|
Returns a string that contains all the properties of the NetStatusEvent object.
| NetStatusEvent | ||
![]() |
Returns the primitive value of the specified object.
| Object | |
| Constant | Defined by | ||
|---|---|---|---|
![]() | ACTIVATE : String = "activate" [static]
Defines the value of the
type property of an activate event object. | Event | |
![]() | ADDED : String = "added" [static]
Defines the value of the
type property of an added event object. | Event | |
![]() | ADDED_TO_STAGE : String = "addedToStage" [static]
Defines the value of the
type property of an addedToStage event object. | Event | |
![]() | CANCEL : String = "cancel" [static]
Defines the value of the
type property of a cancel event object. | Event | |
![]() | CHANGE : String = "change" [static]
Defines the value of the
type property of a change event object. | Event | |
![]() | CLOSE : String = "close" [static]
Defines the value of the
type property of a close event object. | Event | |
![]() | CLOSING : String = "closing" [static]
Defines the value of the
type property of a closing event object. | Event | |
![]() | COMPLETE : String = "complete" [static]
Defines the value of the
type property of a complete event object. | Event | |
![]() | CONNECT : String = "connect" [static]
Defines the value of the
type property of a connect event object. | Event | |
![]() | DEACTIVATE : String = "deactivate" [static]
Defines the value of the
type property of a deactivate event object. | Event | |
![]() | DOM_INITIALIZE : String = "domInitialize" [static]
Defines the value of the
type property of a domInitialize event object. | Event | |
![]() | ENTER_FRAME : String = "enterFrame" [static]
Defines the value of the
type property of an enterFrame event object. | Event | |
![]() | FULLSCREEN : String = "fullScreen" [static]
Defines the value of the
type property of a fullScreen event object. | Event | |
![]() | HTML_BOUNDS_CHANGE : String = "htmlBoundsChange" [static]
Defines the value of the
type property of an htmlBoundsChange event object. | Event | |
![]() | HTML_RENDER : String = "htmlRender" [static]
Defines the value of the
type property of an htmlRender event object. | Event | |
![]() | ID3 : String = "id3" [static]
Defines the value of the
type property of an id3 event object. | Event | |
![]() | INIT : String = "init" [static]
Defines the value of the
type property of an init event object. | Event | |
![]() | LOCATION_CHANGE : String = "locationChange" [static]
Defines the value of the
type property of a locationChange event object. | Event | |
![]() | MOUSE_LEAVE : String = "mouseLeave" [static]
Defines the value of the
type property of a mouseLeave event object. | Event | |
| NET_STATUS : String = "netStatus" [static]
Defines the value of the
type property of a netStatus event object. | NetStatusEvent | ||
![]() | NETWORK_CHANGE : String = "networkChange" [static]
Defines the value of the
type property of a networkChange event object. | Event | |
![]() | OPEN : String = "open" [static]
Defines the value of the
type property of an open event object. | Event | |
![]() | REMOVED : String = "removed" [static]
Defines the value of the
type property of a removed event object. | Event | |
![]() | REMOVED_FROM_STAGE : String = "removedFromStage" [static]
Defines the value of the
type property of a removedFromStage event object. | Event | |
![]() | RENDER : String = "render" [static]
Defines the value of the
type property of a render event object. | Event | |
![]() | RESIZE : String = "resize" [static]
Defines the value of the
type property of a resize event object. | Event | |
![]() | SCROLL : String = "scroll" [static]
Defines the value of the
type property of a scroll event object. | Event | |
![]() | SELECT : String = "select" [static]
Defines the value of the
type property of a select event object. | Event | |
![]() | SOUND_COMPLETE : String = "soundComplete" [static]
Defines the value of the
type property of a soundComplete event object. | Event | |
![]() | TAB_CHILDREN_CHANGE : String = "tabChildrenChange" [static]
Defines the value of the
type property of a tabChildrenChange event object. | Event | |
![]() | TAB_ENABLED_CHANGE : String = "tabEnabledChange" [static]
Defines the value of the
type property of a tabEnabledChange event object. | Event | |
![]() | TAB_INDEX_CHANGE : String = "tabIndexChange" [static]
Defines the value of the
type property of a tabIndexChange event object. | Event | |
![]() | UNLOAD : String = "unload" [static]
Defines the value of the
type property of an unload event object. | Event | |
| info | property |
info:Object [read-write]An object with properties that describe the object's status or error condition.
The information object could have a code property containing a string
that represents a specific event or a level property containing a string
that is either "status" or "error".
The information object could also be something different. The code and
level properties might not work for some implementations and some servers
might send different objects.
For example, Flex Data Services sends Message
objects that cause coercion errors if you try to access the code or
level property.
The following table describes the possible values of the code and level
properties.
| Code property | Level property | Meaning |
|---|---|---|
NetStream.Buffer.Empty |
"status" |
Data is not being received quickly enough to fill the buffer. Data flow will be interrupted until the buffer refills, at which time a NetStream.Buffer.Full message will be sent and the stream will begin playing again. |
NetStream.Buffer.Full |
"status" |
The buffer is full and the stream will begin playing. |
NetStream.Buffer.Flush |
"status" |
Data has finished streaming, and the remaining buffer will be emptied. |
NetStream.Publish.Start |
"status" |
Publish was successful. |
NetStream.Publish.BadName |
"error" |
Attempt to publish a stream which is already being published by someone else. |
NetStream.Publish.Idle |
"status" |
The publisher of the stream has been idling for too long. |
NetStream.Unpublish.Success |
"status" |
The unpublish operation was successfuul. |
NetStream.Play.Start |
"status" |
Playback has started. |
NetStream.Play.Stop |
"status" |
Playback has stopped. |
NetStream.Play.Failed |
"error" |
An error has occurred in playback for a reason other than those listed elsewhere in this table, such as the subscriber not having read access. |
NetStream.Play.StreamNotFound |
"error" |
The FLV passed to the play() method can't be found. |
NetStream.Play.Reset |
"status" |
Caused by a play list reset. |
NetStream.Play.PublishNotify |
"status" |
The initial publish to a stream is sent to all subscribers. |
NetStream.Play.UnpublishNotify |
"status" |
An unpublish from a stream is sent to all subscribers. |
NetStream.Pause.Notify |
"status" |
The stream is paused. |
NetStream.Unpause.Notify |
"status" |
The stream is resumed. |
NetStream.Record.Start |
"status" |
Recording has started. |
NetStream.Record.NoAccess |
"error" |
Attempt to record a stream that is still playing or the client has no access right. |
NetStream.Record.Stop |
"status" |
Recording stopped. |
NetStream.Record.Failed |
"error" |
An attempt to record a stream failed. |
NetStream.Seek.Failed |
"error" |
The seek fails, which happens if the stream is not seekable. |
NetStream.Seek.InvalidTime |
"error" |
For video downloaded with progressive download, the user has tried to seek or play
past the end of the video data that has downloaded thus far, or past
the end of the video once the entire file has downloaded. The message.details
property contains a time code
that indicates the last valid position to which the user can seek. |
NetStream.Seek.Notify |
"status" |
The seek operation is complete. |
NetConnection.Call.BadVersion |
"error" |
Packet encoded in an unidentified format. |
NetConnection.Call.Failed |
"error" |
The NetConnection.call method was not able to invoke the server-side
method or command. |
NetConnection.Call.Prohibited |
"error" |
An Action Message Format (AMF) operation is prevented for security reasons. Either the AMF URL is not in the same domain as the SWF file, or the AMF server does not have a policy file that trusts the domain of the SWF file. |
NetConnection.Connect.Closed |
"status" |
The connection was closed successfully. |
NetConnection.Connect.Failed |
"error" |
The connection attempt failed. |
NetConnection.Connect.Success |
"status" |
The connection attempt succeeded. |
NetConnection.Connect.Rejected |
"error" |
The connection attempt did not have permission to access the application. |
NetConnection.Connect.AppShutdown |
"error" |
The specified application is shutting down. |
NetConnection.Connect.InvalidApp |
"error" |
The application name specified during connect is invalid. |
SharedObject.Flush.Success |
"status" |
The "pending" status is resolved and the SharedObject.flush() call succeeded. |
SharedObject.Flush.Failed |
"error" |
The "pending" status is resolved, but the SharedObject.flush() failed. |
SharedObject.BadPersistence |
"error" |
A request was made for a shared object with persistence flags, but the request cannot be granted because the object has already been created with different flags. |
SharedObject.UriMismatch |
"error" |
An attempt was made to connect to a NetConnection object that has a different URI (URL) than the shared object. |
If you consistently see errors regarding the buffer, try changing the buffer using the NetStream.bufferTime property.
public function get info():Object
public function set info(value:Object):void
See also
| NetStatusEvent | () | constructor |
public function NetStatusEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, info:Object = null)
Creates an Event object that contains information about netStatus events.
Event objects are passed as parameters to event listeners.
type:String — The type of the event. Event listeners can access this information through the inherited type property. There is only one type of status event: NetStatusEvent.NET_STATUS.
|
|
bubbles:Boolean (default = false) — 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:Boolean (default = false) — Determines whether the Event object can be canceled. Event listeners can access this information through the inherited cancelable property.
|
|
info:Object (default = null) — An object containing properties that describe the object's status. Event listeners can access this object through the info property.
|
See also
| clone | () | method |
public override function clone():EventCreates a copy of the NetStatusEvent object and sets the value of each property to match that of the original.
ReturnsEvent —
A new NetStatusEvent object with property values that match those of the original.
|
| toString | () | method |
public override function toString():String
Returns a string that contains all the properties of the NetStatusEvent object. The string is in the following format:
[NetStatusEvent type=value bubbles=value cancelable=value info=value]
ReturnsString —
A string that contains all the properties of the NetStatusEvent object.
|
| NET_STATUS | constant |
public static const NET_STATUS:String = "netStatus"
Defines the value of the type property of a netStatus event object.
This event has the following properties:
| Property | Value |
|---|---|
bubbles | false |
cancelable | false; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
info | An object with properties that describe the object's status or error condition. |
target | The NetConnection or NetStream object reporting its status. |
See also
In this example, the netStatusHandler method is registered as a listener for
the NetStatusEvent event NetConnection.netStatus.
When the status (success or failure) of the NetConnection.connect() attempt
is determined, the netStatus event triggers this method. If the
attempt to connect to the NetConnection object is successful (in other words,
if the info property of the NetStatusEvent object dispatched by the netStatus
event has a code property that indicates success), the code creates the Video and NetStream
objects and calls the Video.attachNetStream() and NetStream.play() methods.
Note: To run this example, you need an FLV file
whose name and location match the variable passed to videoURL;
in this case, an FLV file called Video.flv that is in the same directory as the SWF file.
package {
import flash.display.Sprite;
import flash.events.*;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class NetStatusEventExample extends Sprite {
private var videoURL:String = "Video.flv";
private var connection:NetConnection;
private var stream:NetStream;
public function NetStatusEventExample() {
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}
private function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Unable to locate video: " + videoURL);
break;
}
}
private function connectStream():void {
var stream:NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var video:Video = new Video();
video.attachNetStream(stream);
stream.play(videoURL);
addChild(video);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function asyncErrorHandler(event:AsyncErrorEvent):void {
// ignore AsyncErrorEvent events.
}
}
}
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/apollo/1.0/aslr/flash/events/NetStatusEvent.html