SharedObject.onStatus( ) Event Handler

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
SharedObject.onStatus( ) Event Handler Flash 6

invoked when a SharedObject generates a status message (error, information, warning)
theSharedObj.onStatus(infoObject)

Arguments

infoObject

An object whose code and level properties contain the status message.

Description

For local SharedObjects, the onStatus( ) event occurs only when flush( ) is invoked and the local storage limit for the domain is too low to save the SharedObject to disk. When the limit is too low, Flash displays a Settings dialog box asking the user to increase the disk space for the current domain. Once the user's decision has been made, onStatus( ) is invoked and passed an infoObject that indicates whether the requested space was added. The infoObject defines two properties, code and level, with possible values pertaining to local SharedObjects listed in Table 18-17. Note that there is no "pending" status associated with onStatus( ); however, the word "pending" is a possible return value of the flush( ) method.

Table 18-17. SharedObject.onStatus( ) infoObject property values for local SharedObjects

code property values

level property values

Meaning

"SharedObject.Flush.Failed"

"error"

The user did not add enough space to store the SharedObject.

"SharedObject.Flush.Success"

"status"

The user added enough space to store the SharedObject.

For local SharedObjects, we need to check the value of the code property only, as shown in the following Example.

Example

The following onStatus( ) handler is executed after the user has decided whether to allow enough disk space to save theSharedObj_so. If enough space is not provided, the code disables the application:

theSharedObj_so.onStatus = function (infoObject) {   // The infoObject's code property tells us whether the user   // provided enough space to save the SharedObject.   if (infoObject.code =  = "SharedObject.Flush.Success") {     // Space was provided.     output_txt.text = "Required disk space added. Application saved.";   } else if (infoObject.code =  = "SharedObject.Flush.Failed") {     // Space was not provided.     output_txt.text += "You must increase disk space to use this application.";     // Display an "application disabled" frame.     gotoAndStop("disabled");   } }

See Also

SharedObject.flush( ), SharedObject.getSize( )

     
       About Safari   |   Terms of Service   |   Privacy Policy   |   Contact Us   |   Help   |   Submit a Problem
    Copyright 2002 O'Reilly & Associates, Inc. All rights reserved.
    1005 Gravenstein Highway North
    Sebastopol, CA 95472
     


    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net