Client-Side Communication ActionScript > SharedObject.data |
![]() ![]() ![]() |
SharedObject.data
Availability
![]() |
Flash Player 6. |
![]() |
Flash Communication Server MX (not required). |
Usage
myLocalOrRemoteSharedObject
.data
Description
Read-only 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 typesArray, Number, Boolean, and so on. For example, the following lines assign values to various aspects of a shared object:
itemsArray = new Array(101,346,483); currentUserIsAdmin = true; currentUserName = "Ramona"; so.data.itemNumbers = itemsArray; so.data.adminPrivileges = currentUserIsAdmin; so.data.userName = currentUserName;
All attributes of a shared object's data
property are available to all clients connected to the shared object, and all of them are saved if the object is persistent.
Note: Do not assign values directly to the data
property of a shared object, as in so.data = someValue
; Flash ignores these assignments.
If you assign null
or undefined
to the attribute of a remote shared object, Flash deletes the attribute, and SharedObject.onSync
is invoked with a code
property of "delete"
. To delete attributes for local shared objects, use code like delete so.data.attributeName
; setting an attribute to null
or undefined
for a local shared object does not delete the attribute.
To create "private" values for a shared objectvalues that are available only to the client instance while the object is in use and are not stored with the object when it is closedcreate properties that are not named data
to store them, as shown in the following example.
so.favoriteColor = "blue"; so.favoriteNightClub = "The Bluenote Tavern"; so.favoriteSong = "My World is Blue";
Example
The following example sets the current stream to the user's selection.
curStream = _root.so.data.msgList[selected].streamName;
See also
![]() ![]() ![]() |