Packagecom.myflashlab.air.extensions.googleGames
Classpublic class Snapshots
InheritanceSnapshots Inheritance flash.events.EventDispatcher

A client to interact with Shapshots.



Public Methods
 MethodDefined By
  
getList($forceReload:Boolean):void
load list of snapshot data for the currently signed-in player.
Snapshots
  
load($name:String):void
Call this method to load a specific snapshot.
Snapshots
  
maxCoverImageSize($callback:Function):void
Gets the maximum data size per snapshot cover image in bytes.
Snapshots
  
maxDataSize($callback:Function):void
Gets the maximum data size per snapshot in bytes.
Snapshots
  
remove($name:String):void
This will delete the data of the snapshot locally and on the server.
Snapshots
  
resolveConflict($conflictId:String, $finalContent:String):void
Resolve a conflict using the provided data.
Snapshots
  
save($name:String, $content:String, $description:String, $coverImg:BitmapData = null, $progressValue:Number = -1, $playedTime:Number = -1, $conflictPolicy:int = -1):void
Save a new snapshot or override any modifications made to the snapshot.
Snapshots
  
showNativeWindow($title:String, $allowAddButton:Boolean, $allowDelete:Boolean, $maxSnapshots:int):void
loads a native window that will let the user select a snapshot.
Snapshots
Public Constants
 ConstantDefined By
  RESOLUTION_POLICY_HIGHEST_PROGRESS : int = 4
[static] In the case of a conflict, the snapshot with the highest progress value will be used.
Snapshots
  RESOLUTION_POLICY_LAST_KNOWN_GOOD : int = 2
[static] In the case of a conflict, the last known good version of this snapshot will be used.
Snapshots
  RESOLUTION_POLICY_LONGEST_PLAYTIME : int = 1
[static] In the case of a conflict, the snapshot with the longest played time will be used.
Snapshots
  RESOLUTION_POLICY_MANUAL : int = -1
[static] In the case of a conflict, the result will be returned to the app for resolution.
Snapshots
  RESOLUTION_POLICY_MOST_RECENTLY_MODIFIED : int = 3
[static] In the case of a conflict, the most recently modified version of this snapshot will be used.
Snapshots
Method Detail
getList()method
public function getList($forceReload:Boolean):void

load list of snapshot data for the currently signed-in player. When you receive the saved game names, you can use the load method to read the content of that item.

Parameters

$forceReload:Boolean

See also

load()
load()method 
public function load($name:String):void

Call this method to load a specific snapshot.

Parameters

$name:String — The name of the snapshot to load.

maxCoverImageSize()method 
public function maxCoverImageSize($callback:Function):void

Gets the maximum data size per snapshot cover image in bytes. Guaranteed to be at least 800 KB. May increase in the future.

Parameters

$callback:Function — two params, size as int, error as Error

maxDataSize()method 
public function maxDataSize($callback:Function):void

Gets the maximum data size per snapshot in bytes. Guaranteed to be at least 3 MB. May increase in the future.

Parameters

$callback:Function — two params, size as int, error as Error

remove()method 
public function remove($name:String):void

This will delete the data of the snapshot locally and on the server.

Parameters

$name:String — Name of the snapshot to be deleted.

resolveConflict()method 
public function resolveConflict($conflictId:String, $finalContent:String):void

Resolve a conflict using the provided data. This will replace the data on the server with the specified contents. Note that it is possible for this operation to result in a conflict itself, in which case resolution should be repeated.

Values which are not included in the metadata change will be resolved to the version currently on the server.

Note that the total size of contents may not exceed the size provided by maxDataSize

Parameters

$conflictId:String
 
$finalContent:String

save()method 
public function save($name:String, $content:String, $description:String, $coverImg:BitmapData = null, $progressValue:Number = -1, $playedTime:Number = -1, $conflictPolicy:int = -1):void

Save a new snapshot or override any modifications made to the snapshot. This will cause the changes to be synced to the server in the background.

Note that the total size of the contents of snapshot may not exceed the size provided by maxDataSize

Parameters

$name:String — The new name for saving the snapshot or the current snapshot name to ovveride.
 
$content:String — The new content for the snapshot to save.
 
$description:String — The new description to set for the snapshot.
 
$coverImg:BitmapData (default = null) — The new cover image to set for the snapshot.
 
$progressValue:Number (default = -1) — The new progress value to set for the snapshot.
 
$playedTime:Number (default = -1) — The new played time to set for the snapshot.
 
$conflictPolicy:int (default = -1) — The conflict resolution policy to use for this snapshot.

showNativeWindow()method 
public function showNativeWindow($title:String, $allowAddButton:Boolean, $allowDelete:Boolean, $maxSnapshots:int):void

loads a native window that will let the user select a snapshot.

Parameters

$title:String — The title to display in the action bar of the returned Activity.
 
$allowAddButton:Boolean — Whether or not to display a "create new snapshot" option in the selection UI.
 
$allowDelete:Boolean — Whether or not to provide a delete overflow menu option for each snapshot in the selection UI.
 
$maxSnapshots:int — The maximum number of snapshots to display in the UI. pass -1 to show all.

Constant Detail
RESOLUTION_POLICY_HIGHEST_PROGRESSConstant
public static const RESOLUTION_POLICY_HIGHEST_PROGRESS:int = 4

In the case of a conflict, the snapshot with the highest progress value will be used.

RESOLUTION_POLICY_LAST_KNOWN_GOODConstant 
public static const RESOLUTION_POLICY_LAST_KNOWN_GOOD:int = 2

In the case of a conflict, the last known good version of this snapshot will be used.

RESOLUTION_POLICY_LONGEST_PLAYTIMEConstant 
public static const RESOLUTION_POLICY_LONGEST_PLAYTIME:int = 1

In the case of a conflict, the snapshot with the longest played time will be used.

RESOLUTION_POLICY_MANUALConstant 
public static const RESOLUTION_POLICY_MANUAL:int = -1

In the case of a conflict, the result will be returned to the app for resolution.

RESOLUTION_POLICY_MOST_RECENTLY_MODIFIEDConstant 
public static const RESOLUTION_POLICY_MOST_RECENTLY_MODIFIED:int = 3

In the case of a conflict, the most recently modified version of this snapshot will be used.