SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Dec 2013
    0 Post(s)
    0 Thread(s)

    ActionScript - Shared objects data

    Hello All, This is my first posting. I hope I have posted the thread in the correct forum if I haven't I do apologize. Anyhow, I have a remote shared object in my app. Whenever, a client changes a remote shared objects property I would like to invoke a sync event.

    I know how to create a shared object but I don't know to change and update data to the clients in real time.
    Example,.if a client changes a name or logs in or out then I hope to generate a sync event that propagates itself to all connected clients.

    I am new to AS3 after coming from JavaScript and Adobe documentations doesn't give many examples so I am really confused how to approach this.

    This is what I have so far below: I know the code is probably full of errors but if you can give me any advice what I am doing wrong I would appreciate it!
    Thank You

    Code Actionscript:
    //creating the shared object
    var client_so:SharedObject = SharedObject.getRemote("mySo", nc.uri, false);
    //linking the shared object to the netconnection object
    client_So.addeventListener(SyncEvent.SYNC, syncHandler);
    //I hope to loop through the sync event looking for an object in the sync event whose code is change
    then use switch to construct to look for the value of that object’s “namefunction syncHandler(se:SyncEvent):void{
       for(var i:int = 0; i < se.changeList.length; i++){
       if(se.changeList[i].code == "change"){
       switch (se.changeList[i].name) { 
       case "clear":
      case "success":
    //Updates the value of a property in a shared object and indicates to the server that the value of the property has changed   
    function loadSo():void{
        client_so.setProperty("status", "online");
    function showSo():void{
    Last edited by Mittineague; Dec 4, 2013 at 14:48.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts