public flush(minDiskSpace:Number) : Object
Writes shared object to a local, persistent file. To guarantee that the shared object will be written to the device, the application must force a write operation by calling the flush() method.
Unlike in Flash Player, the write operation is asynchronous and the result is not immediately available.
minDiskSpace:Number - An integer specifying the number of bytes that must be allotted for this object. The default value is 0.
Object - A Boolean value, true or false; or a string value of "pending". The flush() method returns pending for most requests, with the following exceptions:
If the flush() method returns pending, the Flash Lite player can show a dialog box asking the user to free up space to increase the amount of disk space available to shared objects. To allow space for the shared object to expand when it is saved in the future, which avoids return values of pending , you can pass a value for minimumDiskSpace. When the Flash Lite player tries to write the file, it searches for the number of bytes passed to minimumDiskSpace, instead of searching for enough space to save the shared object at its current size.
The following example handles the possible return values for the flush() method:
so_big = SharedObject.getLocal("large");
so_big.data.name = "This is a long string of text.";
so_big.flush();
var flushResult = so_big.flush();
switch (flushResult) {
case 'pending' :
result.text += "pending";
break;
case true :
result.text += "Data was flushed.";
break;
case false :
result.text += "Test failed. Data was not flushed.";
break;
}
clear (SharedObject.clear method), onStatus (SharedObject.onStatus handler)