onSync Template (SSAS and Flash)


The script template in Listing E.8 can be used to handle any SharedObject onSync event on the client and the server.

Listing E.8 onSync ActionScript Template
 onSyncTemplate = function (info) {       trace("Synchronizing Data");       //       // Use this structure as a prototype for your onSync Handlers.       // Loop through the Array of Objects using the IN operator       //       for (name in info) {             trace("[sync] Reading Array Object #"+name+" code("+info[name].code+", graphics/ccc.gif "+info[name].name+")");             //             // ::: The following switch handles code values returned by the object             // Place Code Here             //             switch (info[name].code) {             case "change" :                   trace("::Handle a change of data by another client");                   // Place Code Here                   break;             case "success" :                   trace("::Handle successful change of data from this server");                   // Place Code Here                   break;             case "reject" :                   trace("::Handle a rejected SharedObject write operation");                   // Place Code Here                   break;             case "clear" :                   trace("::Handle an initialization of the SharedObject");                   // Place Code Here                   break;             case "delete" :                   trace("::Handle deleted Attributes");                   // Place Code Here              }             // ::: End the Switch, continue Looping through the Information Object       }       // ::: Complete the onSync Handler }; // Connect to Remote SharedObject using the onSync Template rem_so = SharedObject.getRemote("myRemoteSO", nc.uri, true);  rem_so.onSync = onSyncTemplate;  rem_so.connect(nc); 


Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net