onStatus (SharedObject.onStatus handler)

onStatus = function(infoObject:Object) {}

Invoked every time an error, warning, or informational note is posted for a shared object. If you want to respond to this event handler, you must create a function to process the information object that is generated by the shared object.

The information object has a code property containing a string that describes the result of the onStatus handler, and a level property containing a string that is either "Status" or "Error".

In addition to this onStatus handler, Flash also provides a super function called System.onStatus. If onStatus is invoked for a particular object and no function is assigned to respond to it, Flash processes a function assigned to System.onStatus, if it exists.

The following events notify you when certain SharedObject activities occur:

Code property

Level property

Meaning

SharedObject.Flush.Failed

Error

SharedObject.flush() command that returned "pending" has failed (the user did not allot additional disk space for the shared object when Flash Player showed the Local Storage Settings dialog box).

SharedObject.Flush.Success

Status

SharedObject.flush() command that returned "pending" has been successfully completed (the user allotted additional disk space for the shared object).

Availability: ActionScript 1.0; Flash Player 6

Parameters

infoObject:Object - A parameter defined according to the status message.

Example

The following example displays different messages based on whether the user chooses to allow or deny the SharedObject object instance to write to the disk.

var message_str:String;
this.createTextField("message_txt", this.getNextHighestDepth(), 0, 0, 300, 22);
message_txt.html = true;
this.createTextField("status_txt", this.getNextHighestDepth(), 10, 30, 300, 100);
status_txt.multiline = true;
status_txt.html = true;

var items_array:Array = new Array(101, 346, 483);
var currentUserIsAdmin:Boolean = true;
var currentUserName:String = "Ramona";
var my_so:SharedObject = SharedObject.getLocal("superfoo");
my_so.data.itemNumbers = items_array;
my_so.data.adminPrivileges = currentUserIsAdmin;
my_so.data.userName = currentUserName;

my_so.onStatus = function(infoObject:Object) {
    status_txt.htmlText = "<textformat tabStops='[50]'>";
    for (var i in infoObject) {
        status_txt.htmlText += "<b>"+i+"</b>"+"\t"+infoObject[i];
    }
    status_txt.htmlText += "</textformat>";
};
            
var flushResult = my_so.flush(1000001);
switch (flushResult) {
case 'pending' :
    message_str = "flush is pending, waiting on user interaction.";
    break;
case true :
    message_str = "flush was successful. Requested storage space approved.";
    break;
case false :
    message_str = "flush failed. User denied request for additional storage.";
    break;
}
message_txt.htmlText = "<a href=\"asfunction:System.showSettings,1\
"><u>"+message_str+"</u></a>";

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

getLocal (SharedObject.getLocal method), onStatus (System.onStatus handler)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002124.html