MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Dokumentacja Strona 355

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 369
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 354
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.
Przeglądanie stron 354
1 2 ... 350 351 352 353 354 355 356 357 358 359 360 ... 368 369

Komentarze do niniejszej Instrukcji

Brak uwag