Player.IO

Build fun, powerful & scalable online and mobile games with the reliable backend your users expect

Sign Up | Sign In

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 the specified 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.

createObject

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

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

deleteKeys

Delete a set of DatabaseObjects from a table

Arguments

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

deleteRange

Delete a range of DatabaseObjects from a table using an index

Arguments

String table
The table to delete the DatabaseObject from
String index
The name of the index to query for the DatabaseObjects to delete
Array path
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.
Object start
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
Object stop
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
Function callback
Function executed when the DatabaseObjects are successfully deleted. No arguments are passed to the the callback methoh.
Function errorHandler
Function executed if an error occurs while deleting the DatabaseObjects

load

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

Arguments

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

loadKeys

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

Arguments

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

loadKeysOrCreate

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

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

loadMyPlayerObject

Loads the DatabaseObject corresponding to the player from the PlayerObjects table

Arguments

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

Example

The following example loads the current players DatabaseObject

loadOrCreate

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

Arguments

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

loadRange

Load a range of DatabaseObjects from a table using the specified index.

Arguments

String table
The table to load the DatabaseObject from
String index
The name of the index to query for the DatabaseObject
Array path
Where in the index to start the range search: 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 ["expert","skyland"] as the indexPath and use the start and stop arguments to determine the range of scores you wish to return. IndexPath can be set to null if there is only one property in the index.
Object start
Where to start the range search. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to include in the results
Object stop
Where to stop the range search. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then stop defines the maximum score to include in the results
int limit
The max amount of objects to return
Function callback
Function executed when the DatabaseObjects are successfully loaded: An array of DatabaseObjects are passed to the method: function(dbarr:Array):void{...}
Function errorHandler
Function executed if an error occurs while loading the DatabaseObjects

loadSingle

Load a DatabaseObject from a table using the specified index.

Arguments

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