Packagecom.whirled
Classpublic class BaseDataPack
InheritanceBaseDataPack Inheritance flash.events.EventDispatcher
SubclassesDataPack

A DataPack is a bundle of stored goodies for use by your game, avatar, or other whirled creation. In a DataPack can be named data values as well as named files.



Public Methods
 MethodDefined by
  
BaseDataPack(bytes:ByteArray = null)
Construct a DataPack to be loaded from the specified source.
BaseDataPack
  
getArray(name:String):Array
Convenience function to access some data as an Array.
BaseDataPack
  
getBoolean(name:String):Boolean
Convenience function to access some data as a Boolean.
BaseDataPack
  
getColor(name:String):uint
Convenience function to access some data as a color (uint).
BaseDataPack
  
getData(name:String, formatType:String = null):*
Get some data, optionally formatted as a different type than that specified in the data xml.
BaseDataPack
  
getFile(name:String):ByteArray
Get a File, as a ByteArray.
BaseDataPack
  
getFileAsString(name:String):String
Get a File, as a String.
BaseDataPack
  
getFileAsXML(name:String):XML
Get a File, as an XML object.
BaseDataPack
  
getInt(name:String):int
Convenience function to access some data as an int.
BaseDataPack
  
getNumber(name:String):Number
Convenience function to access some data as a Number.
BaseDataPack
  
getPoint(name:String):Point
Convenience function to access some data as a Point.
BaseDataPack
  
getRectangle(name:String):Rectangle
Convenience function to access some data as a Rectangle.
BaseDataPack
  
getString(name:String):String
Convenience function to access some data as a String.
BaseDataPack
  
isComplete():Boolean
Has the loading of the datapack completed?
BaseDataPack
Protected Methods
 MethodDefined by
  
extractStringValue(datum:XML, valueField:String = "value"):*
Extract from the datum either a String, null, or undefined.
BaseDataPack
  
getDatum(list:XMLList, name:String):XML
Fucking hell.
BaseDataPack
  
parseValueFromString(string:String, type:String):Object
BaseDataPack
Events
 EventSummaryDefined by
   Dispatched when the DataPack could not load due to an error.BaseDataPack
Constructor detail
BaseDataPack()constructor
public function BaseDataPack(bytes:ByteArray = null)

Construct a DataPack to be loaded from the specified source. Note that passing a ByteArray will result in a DataPack that is instantly complete.

Parameters
bytes:ByteArray (default = null) — a ByteArray containing the raw data.
Method detail
extractStringValue()method
protected function extractStringValue(datum:XML, valueField:String = "value"):*

Extract from the datum either a String, null, or undefined.

Parameters
datum:XML
 
valueField:String (default = "value")

Returns
*
getArray()method 
public function getArray(name:String):Array

Convenience function to access some data as an Array.

Parameters
name:String

Returns
Array
getBoolean()method 
public function getBoolean(name:String):Boolean

Convenience function to access some data as a Boolean.

Parameters
name:String

Returns
Boolean
getColor()method 
public function getColor(name:String):uint

Convenience function to access some data as a color (uint).

Parameters
name:String

Returns
uint
getData()method 
public function getData(name:String, formatType:String = null):*

Get some data, optionally formatted as a different type than that specified in the data xml.

Parameters
name:String
 
formatType:String (default = null)

Returns
*
getDatum()method 
protected function getDatum(list:XMLList, name:String):XML

Fucking hell. var datum :XML = getDatum(_metadata..data, value); This should be: var datum :XML = _metadata..data.(

Parameters
list:XMLList
 
name:String

Returns
XML
getFile()method 
public function getFile(name:String):ByteArray

Get a File, as a ByteArray.

Parameters
name:String

Returns
ByteArray
getFileAsString()method 
public function getFileAsString(name:String):String

Get a File, as a String.

Parameters
name:String

Returns
String
getFileAsXML()method 
public function getFileAsXML(name:String):XML

Get a File, as an XML object.

Parameters
name:String

Returns
XML
getInt()method 
public function getInt(name:String):int

Convenience function to access some data as an int.

Parameters
name:String

Returns
int
getNumber()method 
public function getNumber(name:String):Number

Convenience function to access some data as a Number.

Parameters
name:String

Returns
Number
getPoint()method 
public function getPoint(name:String):Point

Convenience function to access some data as a Point.

Parameters
name:String

Returns
Point
getRectangle()method 
public function getRectangle(name:String):Rectangle

Convenience function to access some data as a Rectangle.

Parameters
name:String

Returns
Rectangle
getString()method 
public function getString(name:String):String

Convenience function to access some data as a String.

Parameters
name:String

Returns
String
isComplete()method 
public function isComplete():Boolean

Has the loading of the datapack completed?

Returns
Boolean
parseValueFromString()method 
protected function parseValueFromString(string:String, type:String):ObjectParameters
string:String
 
type:String

Returns
Object
Event detail
errorevent 
Event object type: flash.events.ErrorEvent

Dispatched when the DataPack could not load due to an error.