Packageflash.events
Classpublic class DataEvent
InheritanceDataEvent Inheritance TextEvent Inheritance Event Inheritance Object

Flash Player dispatches DataEvent objects when raw data has completed loading into Flash Player but before Flash Player has parsed the data and called the Event.COMPLETE event. There is only one type of data event: DataEvent.DATA.

View the examples.

See also
flash.net.XMLSocket, DataEvent.DATA


Public Constants
Hide Inherited Public Constants
Show Inherited Public Constants
 PropertyDefined by
 InheritedACTIVATE : String = "activate"
[static] Dispatched when Flash Player gains operating system focus and becomes active.
Event
 InheritedADDED : String = "added"
[static] Dispatched when a display object is added to the display list.
Event
 InheritedCANCEL : String = "cancel"
[static] Dispatched when a file upload or download is cancelled by the user.
Event
 InheritedCHANGE : String = "change"
[static] Dispatched after a control's value is modified.
Event
 InheritedCLOSE : String = "close"
[static] Dispatched by an Socket or XMLSocket object after a network connection is closed.
Event
 InheritedCOMPLETE : String = "complete"
[static] Dispatched when data has loaded successfully.
Event
 InheritedCONNECT : String = "connect"
[static] Dispatched when a network connection has been established.
Event
  DATA : String = "data"
[static] Flash Player dispatches the data event after raw data has finished loading.
DataEvent
 InheritedDEACTIVATE : String = "deactivate"
[static] Dispatched when Flash Player loses operating system focus and is becoming inactive.
Event
 InheritedENTER_FRAME : String = "enterFrame"
[static] Dispatched when the playhead is entering a new frame.
Event
 InheritedID3 : String = "id3"
[static] Dispatched by a Sound object when ID3 data is available for an MP3 sound.
Event
 InheritedINIT : String = "init"
[static] Dispatched by a LoaderInfo object when the properties and methods of a loaded SWF file are accessible.
Event
 InheritedLINK : String = "link"
[static] Flash Player dispatches the link event when a user clicks a hyperlink in an HTML-enabled text field, where the URL begins with "event:".
TextEvent
 InheritedMOUSE_LEAVE : String = "mouseLeave"
[static] Dispatched by the Stage object when the mouse pointer moves out of the Flash Player window area.
Event
 InheritedOPEN : String = "open"
[static] Dispatched by a LoaderInfo, URLLoader, URLStream or FileReference object when a network operation starts.
Event
 InheritedREMOVED : String = "removed"
[static] Dispatched when a display object is about to be removed from the display list.
Event
 InheritedRENDER : String = "render"
[static] Dispatched when the display list is about to be updated and rendered.
Event
 InheritedRESIZE : String = "resize"
[static] Dispatched when scaleMode property of the Stage object is set to StageScaleMode.NO_SCALE and the SWF file has been resized.
Event
 InheritedSCROLL : String = "scroll"
[static] Dispatched by a TextField object after the user scrolls.
Event
 InheritedSELECT : String = "select"
[static] Dispatched by a FileReference object when an item has been selected.
Event
 InheritedSOUND_COMPLETE : String = "soundComplete"
[static] Dispatched by a Sound object when a sound has finished playing.
Event
 InheritedTAB_CHILDREN_CHANGE : String = "tabChildrenChange"
[static] Dispatched by an InteractiveObject instance when the value of the object's tabChildren flag changes.
Event
 InheritedTAB_ENABLED_CHANGE : String = "tabEnabledChange"
[static] Dispatched by an InteractiveObject instance when the the object's tabEnabled flag changes.
Event
 InheritedTAB_INDEX_CHANGE : String = "tabIndexChange"
[static] Dispatched by an InteractiveObject instance when the value of the object's tabIndex property changes.
Event
 InheritedTEXT_INPUT : String = "textInput"
[static] Flash Player dispatches the textInput event when a user enters one or more characters of text.
TextEvent
 InheritedUNLOAD : String = "unload"
[static] Dispatched by a LoaderInfo object whenever a loaded object is removed using the unload() method of the Loader object, or when a second load is performed by the same Loader object and the orignal content is removed prior to the load beginning.
Event
Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties
 PropertyDefined by
 Inheritedbubbles : Boolean
Indicates whether an event is a bubbling event.
Event
 Inheritedcancelable : Boolean
Indicates whether the behavior associated with the event can be prevented.
Event
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcurrentTarget : Object
Indicates the object that is actively processing the Event object with an event listener.
Event
  data : String
The raw data loaded into Flash Player.
DataEvent
 InheritedeventPhase : uint
Indicates the current phase in the event flow.
Event
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedtarget : Object
Indicates the event target.
Event
 Inheritedtext : String
For a textInput event, the character or sequence of characters entered by the user.
TextEvent
 Inheritedtype : String
Indicates the type of event.
Event
Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods
 FunctionDefined by
  
DataEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:String = "")
Creates an event object that contains information about data events.
DataEvent
  
Creates a copy of the DataEvent object and sets the value of each property to match that of the original.
DataEvent
 Inherited
formatToString(className:String, ... arguments):String
A utility function that you use to implement the toString() method in your custom Event class.
Event
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
This method checks whether preventDefault() has been called on the event and returns true if preventDefault() has been called and false otherwise.
Event
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Cancels an event's default behavior if that behavior can be cancelled.
Event
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow.
Event
 Inherited
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 DataEvent object.
DataEvent
 Inherited
Returns the primitive value of the specified object.
Object
Constant detail
DATA constant
public static const DATA:String = "data"

Flash Player dispatches the data event after raw data has finished loading.

This event has the following characteristics:

PropertiesValues
targetThe Loader, URLLoader, or URLStream receiving data. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelableNo. There is no default behavior to cancel.

See also
flash.net.XMLSocket
Property detail
data property
data:String  [read-write]

The raw data loaded into Flash Player.

Implementation
    public function get data():String
    public function set data(value:String):void
Constructor detail
DataEvent constructor

public function DataEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:String = "")

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

Parameters
type:String — The type of the event. Event listeners can access this information through the inherited type property. There is only one type of data event: DataEvent.DATA.
bubbles:Boolean (default = false) — Determines whether the Event object participates in the bubbling phase 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 cancelled. Event listeners can access this information through the inherited cancelable property.
data:String (default = "") — The raw data loaded into Flash Player. Event listeners can access this information through the data property.

See also
flash.net.XMLSocket, DataEvent.DATA
Method detail
clone method

public override function clone():Event

Creates a copy of the DataEvent object and sets the value of each property to match that of the original.

Returns
Event — A new DataEvent 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 DataEvent object. The string is in the following format:

[DataEvent type=value bubbles=value cancelable=value data=value]

Returns
String — A string that contains all the properties of the DataEvent object.
Class examples

The following example creates an XMLSocket and connects it to a socket server that should be running on [yourDomain] port 8080. An event listener is attached to the XMLSocket object that listens for data events, which are dispatched whenever raw data is received.

Notes:

package {
    import flash.display.Sprite;
    import flash.events.DataEvent;
    import flash.net.XMLSocket;

    public class DataEventExample extends Sprite {
        private var hostName:String = "[yourDomain]";
        private var port:uint = 8080;
        private var socket:XMLSocket;

        public function DataEventExample() {
            socket = new XMLSocket();
            socket.addEventListener(DataEvent.DATA, dataHandler);
            socket.connect(hostName, port);
        }

        private function dataHandler(event:DataEvent):void {
            trace("dataHandler: " + event.data);
        }
    }
}




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/flashauthoringpreview/flash/events/DataEvent.html