views:

515

answers:

1

I'm trying to store all the users inside a sharedObject thats created on the server-side, so all the users get a synchronized list of all the online users.

I think I create the sharedObject correct on the server-side but I cant "find" the sharedObject in the flash application.

Inside the Java Red5 Application class:

ISharedObject userList; 

public boolean connect(IConnection conn, IScope scope, Object[] params) 
{     
    if(userList == null)
    {
        createSharedObject(scope, "userList", false);
        userList = getSharedObject(scope, "userList");
    }

    userList.setAttribute( "user", "some name" );

    return true;
}

The Flash sharedObject looks like this:

private var _userSO:SharedObject;

private function initUserSO() // I call this function when I get a netConnection
{
    _userSO = SharedObject.getRemote("userList", this.uri, false); 
    _userSO.addEventListener(SyncEvent.SYNC,syncUsers);
    _userSO.connect(this); // this = netconnection
}

private function syncUsers(e:SyncEvent):void
{
    MonsterDebugger.trace('userManager',_userSO.data);
}

But the _userSO doesn't seem to find the sharedObject on the server.

A: 

I found out that you could use the below line to execute as3 script instead of storing the data inside a sharedObject:

ServiceUtils.invokeOnAllConnections(room, "my_as3_function", userList);
Dennis