Answered
Problem with shared objects synchoronization.
I encountered a small problem with shared objects.
I'm working on a program that creates chat rooms of a fixed size of 30 users. When the 31th user comes, a new room is created.
The idea is that the client first connects to the first room and checks if it's full by connecting to shared objects. If it is full, connection is closed and process is reapeated on a new instance of the application.
I use a function to connect to an instance, which takes as a parameter a number (1 for instance room_1, 2 for room_2, etc). The function itself creates the necessary Netconnection and sharedObject objects.
If a room is full, Netconnections and sharedObjects are closed and function is called again with another number.
I have no problem for connecting to the first room, but after closing the first connection and connecting to the new room, there seem to be some problems with the shared objects (especially, OnSync doesn't seem to execute again after the connection to the shared objects of the new instance).
I was wondering if you had any ideas what could cause this. Is it the use of the same variable names for connecting at two different shared objects?
Here is the function :
function initStreams(room) {
client_nc = new NetConnection();
client_nc.connect("rtmp://192.168.0.4/Elearning/room_"+room);
in_ns = new NetStream(client_nc);
in_ns2 = new NetStream(client_nc);
Replay_video.attachVideo(in_ns);
out_ns = new NetStream(client_nc);
out_ns2 = new NetStream(client_nc);
in_ns.play("my_recorded_stream");
users_name = SharedObject.getRemote("users_name", _root.client_nc.uri, false);
users_name.connect(_root.client_nc);
users_language = SharedObject.getRemote("users_language", _root.client_nc.uri, false);
users_language.connect(_root.client_nc);
users_picture = SharedObject.getRemote("users_picture", _root.client_nc.uri, false);
users_picture.connect(_root.client_nc);
users_finger = SharedObject.getRemote("users_finger", _root.client_nc.uri, false);
users_finger.connect(_root.client_nc);
}
I you need more info, I can post more of the code on the forum.
Any help would be really appreciated
I'm working on a program that creates chat rooms of a fixed size of 30 users. When the 31th user comes, a new room is created.
The idea is that the client first connects to the first room and checks if it's full by connecting to shared objects. If it is full, connection is closed and process is reapeated on a new instance of the application.
I use a function to connect to an instance, which takes as a parameter a number (1 for instance room_1, 2 for room_2, etc). The function itself creates the necessary Netconnection and sharedObject objects.
If a room is full, Netconnections and sharedObjects are closed and function is called again with another number.
I have no problem for connecting to the first room, but after closing the first connection and connecting to the new room, there seem to be some problems with the shared objects (especially, OnSync doesn't seem to execute again after the connection to the shared objects of the new instance).
I was wondering if you had any ideas what could cause this. Is it the use of the same variable names for connecting at two different shared objects?
Here is the function :
function initStreams(room) {
client_nc = new NetConnection();
client_nc.connect("rtmp://192.168.0.4/Elearning/room_"+room);
in_ns = new NetStream(client_nc);
in_ns2 = new NetStream(client_nc);
Replay_video.attachVideo(in_ns);
out_ns = new NetStream(client_nc);
out_ns2 = new NetStream(client_nc);
in_ns.play("my_recorded_stream");
users_name = SharedObject.getRemote("users_name", _root.client_nc.uri, false);
users_name.connect(_root.client_nc);
users_language = SharedObject.getRemote("users_language", _root.client_nc.uri, false);
users_language.connect(_root.client_nc);
users_picture = SharedObject.getRemote("users_picture", _root.client_nc.uri, false);
users_picture.connect(_root.client_nc);
users_finger = SharedObject.getRemote("users_finger", _root.client_nc.uri, false);
users_finger.connect(_root.client_nc);
}
I you need more info, I can post more of the code on the forum.
Any help would be really appreciated
