120
Client-Side ActionScript Language Reference
Before attempting to work with a remote shared object, you should first check for a return
value of
true
, indicating a successful connection, and then wait until you receive a result from
the function you have assigned to
SharedObject.onSync
. If you fail to do so, any changes
you make to the object locally—before
SharedObject.onSync
is invoked—may be lost.
See also
NetConnection class
,
SharedObject.getRemote()
,
SharedObject.onSync
SharedObject.data
Availability
■
Flash Player 6.
■
Flash Media Server (not required).
Usage
myLocalOrRemote_so
.data
Description
Property; the collection of attributes assigned to the
data
property of the object; these
attributes can be shared and/or stored. Each attribute can be an object of any of the basic
ActionScript or JavaScript types—Array, Number, Boolean, and so on. For example, the
following lines assign values to various aspects of a shared object:
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;
for (var prop in my_so.data) {
trace(prop+": "+my_so.data[prop]);
}
NO
TE
SharedObject.onSync
is not invoked if this call returns
false.