EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Getlocal (Sharedobject.getlocal Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SharedObject 1087
Example
The following function gets a shared object,
my_so, and fills writable properties with user-
provided settings. Finally,
flush() is called to save the settings and allot a minimum of 1000
bytes of disk space.
this.syncSettingsCore = function(soName:String, override:Boolean,
settings:Object) {
var my_so:SharedObject = SharedObject.getLocal(soName, "http://
www.mydomain.com/app/sys");
// settings list index
var i;
// For each specified value in settings:
// If override is true, set the persistent setting to the provided value.
// If override is false, fetch the persistent setting, unless there
// isn't one, in which case, set it to the provided value.
for (i in settings) {
if (override || (my_so.data[i] == null)) {
my_so.data[i] = settings[i];
} else {
settings[i] = my_so.data[i];
}
}
my_so.flush(1000);
};
See also
clear (SharedObject.clear method), onStatus (SharedObject.onStatus handler)
getLocal (SharedObject.getLocal method)
public static getLocal(name:String, [localPath:String], [secure:Boolean]) :
SharedObject
Returns a reference to a locally persistent shared object that is available only to the current
client. If the shared object does not already exist, this method creates one. This method is a
static method of the SharedObject class. To assign the object to a variable, use syntax like the
following:
var so:SharedObject = SharedObject.getLocal("savedData")
NOTE
If the user has selected to never allow local storage for this domain, the object is not
saved locally, even if a value for localPath is specified. The exception to this rule is local
content. Local content can always write shared objects from third-party domains
(domains other than the domain in the current browser address bar) to disk, even if
writing of third-party shared objects to disk is disallowed. .

Table of Contents

Related product manuals