DataLoad
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.load |
| Inherits from: | LoadItem < Process < RemovableEventDispatcher < EventDispatcher |
| Version: | 09/06/09 |
| Author: | Aaron Clinger |
| Classpath: | org.casalib.load.DataLoad |
| File last modified: | Sunday, 06 September 2009, 08:46:36 |
Provides an easy and standardized way to load data.
Example:
-
package { import org.casalib.display.CasaMovieClip; import org.casalib.events.LoadEvent; import org.casalib.load.DataLoad; public class MyExample extends CasaMovieClip { protected var _dataLoad:DataLoad; public function MyExample() { super(); this._dataLoad = new DataLoad("data.xml"); this._dataLoad.addEventListener(LoadEvent.COMPLETE, this._onComplete); this._dataLoad.start(); } protected function _onComplete(e:LoadEvent):void { trace(this._dataLoad.dataAsXml.toXMLString()); } } }
Events broadcasted to listeners:
- HTTPStatusEvent with type:
HTTP_STATUS- Dispatched if class is able to detect and return the status code for the request. - SecurityErrorEvent with type:
SECURITY_ERROR- Dispatched if load is outside the security sandbox.
Summary
Constructor
- DataLoad (request:*, dataFormat:String = URLLoaderDataFormat.TEXT)
- Creates and defines a DataLoad.
Class properties
Class properties inherited from Process
Instance properties
- urlLoader : URLLoader
- The URLLoader being used to download the data.
- data : *
- The data received from the DataLoad.
- dataFormat : String
- The data type that DataLoad is receiving.
- dataAsString : String
- The data received from the DataLoad data typed as String.
- dataAsXml : XML
- The data received from the DataLoad data typed as XML.
- dataAsUrlVariables : URLVariables
- The data received from the DataLoad data typed as URLVariables.
- dataAsByteArray : ByteArray
- The data received from the DataLoad data typed as ByteArray.
Instance properties inherited from LoadItem
Instance properties inherited from Process
Instance properties inherited from RemovableEventDispatcher
Instance methods
- destroy : void
Instance methods inherited from LoadItem
Instance methods inherited from RemovableEventDispatcher
Constructor
DataLoad
public function DataLoad (
request:*,
dataFormat:String = URLLoaderDataFormat.TEXT)
Creates and defines a DataLoad.
Parameters:
request :
A
String or an URLRequest reference to the file you wish to load.dataFormat:
Sets whether the data is received as as text, raw binary data or URL-encoded variables; defaults to text.
Instance properties
data
public data:*
(read)
The data received from the DataLoad. Available after load is complete.
Throws:
- Error if method is called before the file has loaded.
dataAsByteArray
public dataAsByteArray:ByteArray
(read)
The data received from the DataLoad data typed as ByteArray. Available after load is complete.
Throws:
- Error if method is called before the file has loaded.
- Error if method cannot convert data to a ByteArray.
dataAsString
public dataAsString:String
(read)
The data received from the DataLoad data typed as String. Available after load is complete.
Throws:
- Error if method is called before the file has loaded.
- Error if method cannot convert data to a String.
dataAsUrlVariables
public dataAsUrlVariables:URLVariables
(read)
The data received from the DataLoad data typed as URLVariables. Available after load is complete.
Throws:
- Error if method is called before the file has loaded.
- Error if method cannot convert data to URLVariables.
dataAsXml
public dataAsXml:XML
(read)
The data received from the DataLoad data typed as XML. Available after load is complete.
Throws:
- Error if method is called before the file has loaded.
- Error if method cannot convert data to XML.
dataFormat
public dataFormat:String
(read)
The data type that DataLoad is receiving.
urlLoader
public urlLoader:URLLoader
(read)
The URLLoader being used to download the data.