
SharedObject.data Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
762
|
ActionScript Language Reference
For a prolonged example showing how to store address book contacts with a SharedObject,
see the following article, written by me:
http://www.macromedia.com/desdev/mx/flash/articles/addressbook.html
Example
The following code creates a SharedObject, named userProfile, that tracks the total
amount of time the user has spent viewing the movie:
var userProfile_so = SharedObject.getLocal("userProfile");
trace(userProfile_so.data.totalVisitTime);
var then = 0;
this.onEnterFrame = function () {
var now = getTimer();
var frameTime = now - then;
userProfile_so.data.totalVisitTime += frameTime;
this.then = now;
}
See Also
“Object Properties,” in Chapter 12
SharedObject.data Property
container for data stored locally or sent to Comm Server
Flash 6
read-only
theSharedObj.data
Description
The data property contains a generic object whose properties are saved to disk when the
movie is unloaded from the Player or when SharedObject.flush() is invoked. If
theSharedObj
is a local SharedObject that has been retrieved from disk, the properties of data contain the
values last saved. Properties can contain the following datatypes: number, string, boolean,
undefined, null, array, and object (custom classes plus XML and Date). Other built-in
ActionScript