Packagenet.flashpunk.utils
Classpublic class Data
InheritanceData Inheritance Object

Static helper class used for saving and loading data from stored cookies.



Public Properties
 PropertyDefined By
  id : String
[static] If you want to share data between different SWFs on the same host, use this id.
Data
Public Methods
 MethodDefined By
  
load(file:String):void
[static] Overwrites the current data with the file.
Data
  
readBool(name:String, defaultValue:Boolean = true):Boolean
[static] Reads a Boolean from the current data.
Data
  
readInt(name:String, defaultValue:int = 0):int
[static] Reads an int from the current data.
Data
  
readString(name:String, defaultValue:String):String
[static] Reads a String from the current data.
Data
  
readUint(name:String, defaultValue:uint = 0):uint
[static] Reads a uint from the current data.
Data
  
save(file:String):void
[static] Overwrites the file with the current data.
Data
  
writeBool(name:String, value:Boolean = true):void
[static] Writes a Boolean to the current data.
Data
  
writeInt(name:String, value:int = 0):void
[static] Writes an int to the current data.
Data
  
writeString(name:String, value:String):void
[static] Writes a String to the current data.
Data
  
writeUint(name:String, value:uint = 0):void
[static] Writes a uint to the current data.
Data
Property Detail
idproperty
public static var id:String

If you want to share data between different SWFs on the same host, use this id.

Method Detail
load()method
public static function load(file:String):void

Overwrites the current data with the file.

Parameters

file:String — The filename to load.

readBool()method 
public static function readBool(name:String, defaultValue:Boolean = true):Boolean

Reads a Boolean from the current data.

Parameters

name:String — Property to read.
 
defaultValue:Boolean (default = true) — Default value.

Returns
Boolean — The property value, or defaultValue if the property is not assigned.
readInt()method 
public static function readInt(name:String, defaultValue:int = 0):int

Reads an int from the current data.

Parameters

name:String — Property to read.
 
defaultValue:int (default = 0) — Default value.

Returns
int — The property value, or defaultValue if the property is not assigned.
readString()method 
public static function readString(name:String, defaultValue:String):String

Reads a String from the current data.

Parameters

name:String — Property to read.
 
defaultValue:String — Default value.

Returns
String — The property value, or defaultValue if the property is not assigned.
readUint()method 
public static function readUint(name:String, defaultValue:uint = 0):uint

Reads a uint from the current data.

Parameters

name:String — Property to read.
 
defaultValue:uint (default = 0) — Default value.

Returns
uint — The property value, or defaultValue if the property is not assigned.
save()method 
public static function save(file:String):void

Overwrites the file with the current data. The current data will not be saved until this function is called.

Parameters

file:String — The filename to save.

writeBool()method 
public static function writeBool(name:String, value:Boolean = true):void

Writes a Boolean to the current data.

Parameters

name:String — Property to write.
 
value:Boolean (default = true) — Value to write.

writeInt()method 
public static function writeInt(name:String, value:int = 0):void

Writes an int to the current data.

Parameters

name:String — Property to write.
 
value:int (default = 0) — Value to write.

writeString()method 
public static function writeString(name:String, value:String):void

Writes a String to the current data.

Parameters

name:String — Property to write.
 
value:String — Value to write.

writeUint()method 
public static function writeUint(name:String, value:uint = 0):void

Writes a uint to the current data.

Parameters

name:String — Property to write.
 
value:uint (default = 0) — Value to write.