Packagecom.greensock.events
Classpublic class LoaderEvent
InheritanceLoaderEvent Inheritance flash.events.Event

An Event dispatched by one of the loaders in the LoaderMax system. Copyright 2011, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.



Public Properties
 PropertyDefined By
  data : *
Event-related data which varies based on the type of event.
LoaderEvent
  target : Object
[override] [read-only] The loader associated with the LoaderEvent.
LoaderEvent
  text : String
For ERROR, FAIL, and CHILD_FAIL events, this text will give more details about the error or failure.
LoaderEvent
Public Methods
 MethodDefined By
  
LoaderEvent(type:String, target:Object, text:String, data:* = null)
Constructor
LoaderEvent
  
clone():Event
[override]
LoaderEvent
Public Constants
 ConstantDefined By
  CANCEL : String = cancel
[static] Dispatched when the loader aborts its loading.
LoaderEvent
  CHILD_CANCEL : String = childCancel
[static] Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children aborts its loading.
LoaderEvent
  CHILD_COMPLETE : String = childComplete
[static] Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children finishes loading.
LoaderEvent
  CHILD_FAIL : String = childFail
[static] Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children fails to load.
LoaderEvent
  CHILD_OPEN : String = childOpen
[static] Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children begins loading.
LoaderEvent
  CHILD_PROGRESS : String = childProgress
[static] Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children dispatches a PROGRESS Event.
LoaderEvent
  COMPLETE : String = complete
[static] Dispatched when the loader finishes loading.
LoaderEvent
  ERROR : String = error
[static] Dispatched when the loader (or one of its children) throws any error, like an IO_ERROR or SECURITY_ERROR.
LoaderEvent
  FAIL : String = fail
[static] Dispatched when the loader fails.
LoaderEvent
  HTTP_RESPONSE_STATUS : String = httpResponseStatus
[static] Dispatched when the loader (or one of its children) receives an HTTP_RESPONSE_STATUS event (see Adobe docs for specifics).
LoaderEvent
  HTTP_STATUS : String = httpStatus
[static] Dispatched when the loader (or one of its children) receives an HTTP_STATUS event (see Adobe docs for specifics).
LoaderEvent
  INIT : String = init
[static] Dispatched when the loader initializes which means different things for different loaders.
LoaderEvent
  IO_ERROR : String = ioError
[static] Dispatched when the the loader (or one of its children) encounters an IO_ERROR (typically when it cannot find the file at the specified url).
LoaderEvent
  OPEN : String = open
[static] Dispatched when the loader begins loading, like when its load() method is called.
LoaderEvent
  PROGRESS : String = progress
[static] Dispatched when the loader's bytesLoaded changes.
LoaderEvent
  SCRIPT_ACCESS_DENIED : String = scriptAccessDenied
[static] When script access is denied for a particular loader (like if an ImageLoader or SWFLoader tries loading from another domain and the crossdomain.xml file is missing or doesn't grant permission properly), a SCRIPT_ACCESS_DENIED LoaderEvent will be dispatched.
LoaderEvent
  SECURITY_ERROR : String = securityError
[static] Dispatched when the loader (or one of its children) encounters a SECURITY_ERROR (see Adobe's docs for details).
LoaderEvent
  UNCAUGHT_ERROR : String = uncaughtError
[static] Dispatched when a swf that's loaded by a SWFLoader encounters an UncaughtErrorEvent which is basically any Error that gets thrown outside of a try...catch statement.
LoaderEvent
  UNLOAD : String = unload
[static] Dispatched when the loader unloads (which happens when either unload() or dispose(true) is called or if a loader is canceled while in the process of loading).
LoaderEvent
Property Detail
dataproperty
public var data:*

Event-related data which varies based on the type of event. For example, VideoLoader dispatches a VIDEO_CUE_POINT event containing data about the cue point. A SWFLoader dispatches an UNCAUGHT_ERROR event containing the original UncaughtErrorEvent instance.

targetproperty 
target:Object  [read-only] [override]

The loader associated with the LoaderEvent. This may be different than the currentTarget. The target always refers to the originating loader, so if there is an ImageLoader nested inside a LoaderMax instance and you add an event listener to the LoaderMax, if the ImageLoader dispatches an error event, the event's target will refer to the ImageLoader whereas the currentTarget will refer to the LoaderMax instance that is currently processing the event.


Implementation
    public function get target():Object
textproperty 
public var text:String

For ERROR, FAIL, and CHILD_FAIL events, this text will give more details about the error or failure.

Constructor Detail
LoaderEvent()Constructor
public function LoaderEvent(type:String, target:Object, text:String, data:* = null)

Constructor

Parameters
type:String — Type of event
 
target:Object — Target
 
text:String — Error text (if any)
 
data:* (default = null)
Method Detail
clone()method
override public function clone():Event

Returns
Event
Constant Detail
CANCELConstant
public static const CANCEL:String = cancel

Dispatched when the loader aborts its loading. This can happen when the loader fails, when cancel() is manually called, or when another loader is prioritized in the loading queue.

CHILD_CANCELConstant 
public static const CHILD_CANCEL:String = childCancel

Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children aborts its loading. This can happen when the loader fails, when cancel() is manually called, or when another loader is prioritized in the loading queue.

CHILD_COMPLETEConstant 
public static const CHILD_COMPLETE:String = childComplete

Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children finishes loading.

CHILD_FAILConstant 
public static const CHILD_FAIL:String = childFail

Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children fails to load.

CHILD_OPENConstant 
public static const CHILD_OPEN:String = childOpen

Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children begins loading.

CHILD_PROGRESSConstant 
public static const CHILD_PROGRESS:String = childProgress

Dispatched by a LoaderMax (or other loader that may dynamically recognize nested loaders like XMLLoader and SWFLoader) when one of its children dispatches a PROGRESS Event.

COMPLETEConstant 
public static const COMPLETE:String = complete

Dispatched when the loader finishes loading.

ERRORConstant 
public static const ERROR:String = error

Dispatched when the loader (or one of its children) throws any error, like an IO_ERROR or SECURITY_ERROR.

FAILConstant 
public static const FAIL:String = fail

Dispatched when the loader fails.

HTTP_RESPONSE_STATUSConstant 
public static const HTTP_RESPONSE_STATUS:String = httpResponseStatus

Dispatched when the loader (or one of its children) receives an HTTP_RESPONSE_STATUS event (see Adobe docs for specifics).

HTTP_STATUSConstant 
public static const HTTP_STATUS:String = httpStatus

Dispatched when the loader (or one of its children) receives an HTTP_STATUS event (see Adobe docs for specifics).

INITConstant 
public static const INIT:String = init

Dispatched when the loader initializes which means different things for different loaders. For example, a SWFLoader dispatches INIT when it downloads enough of the swf to render the first frame. When a VideoLoader receives MetaData, it dispatches its INIT event, as does an MP3Loader when it receives ID3 data. See the docs for each class for specifics.

IO_ERRORConstant 
public static const IO_ERROR:String = ioError

Dispatched when the the loader (or one of its children) encounters an IO_ERROR (typically when it cannot find the file at the specified url).

OPENConstant 
public static const OPEN:String = open

Dispatched when the loader begins loading, like when its load() method is called.

PROGRESSConstant 
public static const PROGRESS:String = progress

Dispatched when the loader's bytesLoaded changes.

SCRIPT_ACCESS_DENIEDConstant 
public static const SCRIPT_ACCESS_DENIED:String = scriptAccessDenied

When script access is denied for a particular loader (like if an ImageLoader or SWFLoader tries loading from another domain and the crossdomain.xml file is missing or doesn't grant permission properly), a SCRIPT_ACCESS_DENIED LoaderEvent will be dispatched.

SECURITY_ERRORConstant 
public static const SECURITY_ERROR:String = securityError

Dispatched when the loader (or one of its children) encounters a SECURITY_ERROR (see Adobe's docs for details).

UNCAUGHT_ERRORConstant 
public static const UNCAUGHT_ERROR:String = uncaughtError

Dispatched when a swf that's loaded by a SWFLoader encounters an UncaughtErrorEvent which is basically any Error that gets thrown outside of a try...catch statement. This can be useful when subloading swfs from a 3rd party that may contain errors. However, UNCAUGHT_ERROR events will only be dispatched if the parent swf is published for Flash Player 10.1 or later! See SWFLoader's suppressUncaughtErrors special property if you'd like to have it automatically suppress these errors. The original UncaughtErrorEvent is stored in the LoaderEvent's data property. So, for example, if you'd like to call preventDefault() on that event, you'd do myLoaderEvent.data.preventDefault().

UNLOADConstant 
public static const UNLOAD:String = unload

Dispatched when the loader unloads (which happens when either unload() or dispose(true) is called or if a loader is canceled while in the process of loading). This can be particularly useful to listen for in a swf that was subloaded by a SWFLoader so that it can get notified when the parent has requested an unload. For example, in the subloaded swf, you could do:

var curParent:DisplayObjectContainer = this.parent;
while (curParent) { 
    if (curParent.hasOwnProperty("rawContent") && curParent.hasOwnProperty("loader")) { 
        Object(curParent).loader.addEventListener("unload", dispose, false, 0, true); 
    }
    curParent = curParent.parent;
}
function dispose(event:Event):void { 
     //do cleanup stuff here like removing event listeners, stopping sounds, closing NetStreams, etc...
}