User Guide
590 ActionScript classes
Returns
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 there is no need to write data (that is, the data has already been written), flush()
returns
true.
■ If the minimumDiskSpace parameter exceeds the maximum space available for a SWF file,
or the remaining space available for a SWF file, or if there was an error processing the
request,
flush() returns false.
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.
Example
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;
}
See also
clear (SharedObject.clear method), onStatus (SharedObject.onStatus handler)