PlayerIO

The fastest way to build online games without breaking a sweat.

ActionScript3 Reference

actionscript 3 BigDB class informationClass BigDB

Namespace: playerio
Language: ActionScript 3

Provides access to the BigDB service provided by Player.IO.

Methods

 
public
createObject (table:String, key:String, data:Object, callback:Function = null, errorHandler:Function = null):void

Creates a new DatabaseObject in the given table with the specified key. If no key is specified, the object will receive an autogenerated id.

public
deleteKeys (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Delete a set of DatabaseObjects from a table

public
deleteRange (table:String, index:String, path:Array, start:Object, stop:Object, callback:Function = null, errorHandler:Function = null):void

Delete a range of DatabaseObjects from a table using an index

public
load (table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Load the DatabaseObject with the given key from the given table.

public
loadKeys (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObjects with the given keys from the given table.

public
loadKeysOrCreate (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads or creates DatabaseObjects with the given keys from the given table. New objects are created if there are no existing objects for the given keys.

public
loadMyPlayerObject (callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObject corresponding to the player from the PlayerObjects table

public
loadOrCreate (table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Loads or creates the DatabaseObject with the given key from the given table.

public
loadRange (table:String, index:String, path:Array, start:Object, stop:Object, limit:int, callback:Function = null, errorHandler:Function = null):void

Load a range of DatabaseObjects from a table using an index

public
loadSingle (table:String, index:String, indexValue:Array, callback:Function = null, errorHandler:Function = null):void

Load a DatabaseObject from a table using the specified index.

BigDB.createObject

public
createObject (table:String, key:String, data:Object, callback:Function = null, errorHandler:Function = null):void

Creates a new DatabaseObject in the given table with the specified key. If no key is specified, the object will receive an autogenerated id.

Arguments

table:String
The table to create the DatabaseObject in.
key:String
The key of the newly created DatabaseObject
data:Object
Initial data of the DatabaseObject passed as an object.
callback:Function (Default = null)
Function executed when the DatabaseObject has successfully been created. The newly created DatabaseObject is passed to the callback handler: function(o:DatabaseObject):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while creating the DatabaseObject

BigDB.deleteKeys

public
deleteKeys (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Delete a set of DatabaseObjects from a table

Arguments

table:String
The table to delete the DatabaseObjects from
keys:Array
The keys of the DatabaseObjects to delete
callback:Function (Default = null)
Function executed when the DatabaseObjects are successfully deleted. No arguments are passed to the the callback methoh.
errorHandler:Function (Default = null)
Function executed if an error occurs while deleting the DatabaseObjects

BigDB.deleteRange

public
deleteRange (table:String, index:String, path:Array, start:Object, stop:Object, callback:Function = null, errorHandler:Function = null):void

Delete a range of DatabaseObjects from a table using an index

Arguments

table:String
The table to delete the DatabaseObject from
index:String
The name of the index to query for the DatabaseObjects to delete
path:Array
Where in the index to start the range delete: An array of objects of the same types as the index properties, specifying where in the index to start loading DatabaseObjects from. For instance, in the index [Mode,Map,Score] you might use new ["expert","skyland"] as the indexPath and use the start and stop arguments to determine the range of scores you wish to delete. IndexPath can be set to null instead of an empty array.
start:Object
Where to start the range delete. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to delete
stop:Object
Where to stop the range delete. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then stop defines the maximum score to delete
callback:Function (Default = null)
Function executed when the DatabaseObjects are successfully deleted. No arguments are passed to the the callback method.
errorHandler:Function (Default = null)
Function executed if an error occurs while deleting the DatabaseObjects

BigDB.load

public
load (table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Load the DatabaseObject with the given key from the given table.

Arguments

table:String
The table to load the DatabaseObject from
key:String
The key of the DatabaseObject to load
callback:Function (Default = null)
Function executed when the DatabaseObject is successfully loaded: function(o:DatabaseObject):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading the DatabaseObject.

BigDB.loadKeys

public
loadKeys (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObjects with the given keys from the given table.

Arguments

table:String
The table to load the DatabaseObject from
keys:Array
Array of keys to load from the given table
callback:Function (Default = null)
Function executed when the DatabaseObjects are successfully loaded. An array of DatabaseObjects are passed to the method: function(dbarr:Array):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading the DatabaseObjects

BigDB.loadKeysOrCreate

public
loadKeysOrCreate (table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads or creates DatabaseObjects with the given keys from the given table. New objects are created if there are no existing objects for the given keys.

Arguments

table:String
The table to load the DatabaseObjects from
keys:Array
They keys of the DatabaseObjects to load
callback:Function (Default = null)
Function executed when the DatabaseObjects are successfully loaded or created: function(dbarr:Array):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading or creating the DatabaseObjects

BigDB.loadMyPlayerObject

public
loadMyPlayerObject (callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObject corresponding to the player from the PlayerObjects table

Arguments

callback:Function (Default = null)
Function executed when the object has loaded successfully: function(o:DatabaseObject):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading the DatabaseObject

Example

The following example loads the current players DatabaseObject

BigDB.loadOrCreate

public
loadOrCreate (table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Loads or creates the DatabaseObject with the given key from the given table.

Arguments

table:String
The table from which to load or create the DatabaseObject
key:String
The key of the DatabaseObject to load or create
callback:Function (Default = null)
Function executed when the DatabaseObject is successfully loaded or created: function(o:DatabaseObject):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading or creating the DatabaseObject

BigDB.loadRange

public
loadRange (table:String, index:String, path:Array, start:Object, stop:Object, limit:int, callback:Function = null, errorHandler:Function = null):void

Load a range of DatabaseObjects from a table using an index

Arguments

table:String
The table to load the DatabaseObjects from
index:String
The name of the index to query for the DatabaseObjects to load
path:Array
Where in the index to start the range load: An array of objects of the same types as the index properties, specifying where in the index to start loading DatabaseObjects from. For instance, in the index [Mode,Map,Score] you might use new ["expert","skyland"] as the indexPath and use the start and stop arguments to determine the range of scores you wish to load. IndexPath can be set to null instead of an empty array.
start:Object
Where to start the range load. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to load
stop:Object
Where to stop the range load. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then stop defines the maximum score to load
limit:int
callback:Function (Default = null)
Function executed when the DatabaseObjects are successfully loaded. function(dbarr:Array):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading the DatabaseObjects

BigDB.loadSingle

public
loadSingle (table:String, index:String, indexValue:Array, callback:Function = null, errorHandler:Function = null):void

Load a DatabaseObject from a table using the specified index.

Arguments

table:String
The table to load the DatabaseObject from
index:String
The name of the index to query for the DatabaseObject
indexValue:Array
An array of objects of the same types as the index properties, specifying which object to load
callback:Function (Default = null)
Function executed when the DatabaseObject is successfully loaded: function(o:DatabaseObject):void{...}
errorHandler:Function (Default = null)
Function executed if an error occurs while loading the DatabaseObject