122
Server-Side ActionScript Language Reference
Description
Method (static); stores either a specific persistent shared object instance or all persistent shared
object instances with an
isDirty
property whose value is
true
. Use this method if the
SharedObject.autoCommit
property is
false
and you need to manage when a shared object
is stored locally.
Example
The following code commits all dirty shared objects to local storage when the application
stops:
application.onAppStop = function (info){
// Insert code here.
SharedObject.commit();
}
SharedObject.flush()
Availability
Flash Communication Server MX 1.0.
Usage
mySO
.flush()
Parameters
None.
Returns
A Boolean value of
true
if successful,
false
otherwise.
Description
Method; saves the current state of a persistent shared object.
Example
The following example places a reference to the shared object
foo
in the variable
myShared
. It
then locks the shared object instance so that no one can make any changes to it, and then
saves the shared object by calling
myShared.flush()
. After the shared object is saved, it is
unlocked so that further changes can be made.
var myShared = SharedObject.get("foo", true);
myShared.lock();
// Insert code here that operates on the shared object.
myShared.flush();
myShared.unlock();