Packageflare.data
Classpublic class DataSource

A data source provides access to remote data on the Internet. A DataSource requires a URL for retrieving a data file, and a format string representing the data format. The currently supported formats are "tab" (Tab-Delimited Text) and "json" (JavaScript Object Notation). Additionally, a DataSource can be given a schema object describing the data fields and their types (int, Number, Date, String, etc). If no schema is provided, the data converter for the particular format will attempt to infer the data types directly from the data itself.

Once a DataSource has been created, use the load method to initiate data loading. This method returns a URLLoader instance. Add a listener to the URLLoader's COMPLETE event to be notified when loading and parsing has been completed. When a COMPLETE event is issued, the URLLoader's data property will contain the loaded and parsed data set.



Public Properties
 PropertyDefined by
  format : String
[read-only] The format of the remote data set (e.g., "tab" or "json").
DataSource
  schema : DataSchema
[read-only] A schema describing the attributes of the data set.
DataSource
  url : String
[read-only] The URL of the remote data set.
DataSource
Public Methods
 MethodDefined by
  
DataSource(url:String, format:String, schema:DataSchema = null)
Creates a new DataSource.
DataSource
  
load():URLLoader
Initiates loading of the data set.
DataSource
Property detail
formatproperty
format:String  [read-only]

The format of the remote data set (e.g., "tab" or "json").

Implementation
    public function get format():String
schemaproperty 
schema:DataSchema  [read-only]

A schema describing the attributes of the data set.

Implementation
    public function get schema():DataSchema
urlproperty 
url:String  [read-only]

The URL of the remote data set.

Implementation
    public function get url():String
Constructor detail
DataSource()constructor
public function DataSource(url:String, format:String, schema:DataSchema = null)

Creates a new DataSource.

Parameters
url:String — the URL of the remote data set
 
format:String — the format of the remote data set (e.g., "tab" or "json")
 
schema:DataSchema (default = null) — an optional schema describing the attibutes of the data set
Method detail
load()method
public function load():URLLoader

Initiates loading of the data set. When the load completes, a data converter instance is used to convert the retrieved data set into ActionScript objects. The parsed data is then available through the data property of the returned URLLoader.

Returns
URLLoader — a URLLoader instance responsible for loading the data set. Add an event listener for the COMPLETE event to be notified when data loading has completed.