
Server-Side Communication ActionScript 55
If you call SharedObject.setProperty on the server side, it invokes a change message in the
SharedObject.onSync method on the client side for any Flash Player client that is using the
shared object. The name parameter on the server side is the same as an attribute of the data
property on the client side. For example, the following two lines of code are equivalent: the first
line is server-side ActionScript, and the second is client-side ActionScript:
sharedInfo.setProperty(nameVal, "foo");
clientSO.data[nameVal] = "foo";
Example
This example uses the SharedObject.setProperty method to create the property city with the
value San Francisco. It then enumerates all the property values in a for loop and prints out the
results in the Output window by using a
trace action.
myInfo = SharedObject.get("foo");
var addr = myInfo.getProperty("address");
myInfo.setProperty("city", "San Francisco");
var names = sharedInfo.getPropertyNames();
for (x in names){
var propVal = sharedInfo.getProperty(names[x]);
trace("Value of property " + names[x] + " = " + propVal);
}
See also
SharedObject.getProperty
SharedObject.size
Availability
Flash Communication Server MX.
Usage
mySharedObject.size()
Parameters
None.
Returns
An integer indicating the number of properties.
Description
Method; returns the total number of valid properties in a shared object.
Example
This example gets the number of properties of a shared object and assigns that number to the
variable
len:
var myShared = SharedObjecd.get(application, "foo", true);
var len = myShared.size();
SharedObject.unlock
Availability
Flash Communication Server MX.
Komentarze do niniejszej Instrukcji