galak
03-20-2009, 04:04 AM
Ok here it goes...
Hi guys, I'm totally new to FMS, but I already have to get down to understanding it real quick, got a dead line for next week to hand a multi conferencing system (but that's not the problem). So here is the question:
I have two similar swf, panel.swf and panel_admin.swf, they are set in the same folder on the server.
I would like them both to be watching the same serverSide object and launch a function if it changes. So the code I have is he following:
Server side
application.onAppStart = function(){
counterSO = SharedObject.get("control_panel", true)
counterSO.setProperty("user", '')
counterSO.setProperty("action", '')
}
application.onConnect = function(clientObj, action, user){
application.acceptConnection(clientObj);
if(user != undefined && action != undefined){
counterSO.setProperty("user", user)
counterSO.setProperty("action", action)
clientObj.call("check_func", null, user, action);
}else{
counterSO.setProperty("user", "")
counterSO.setProperty("action", "")
}
}
On the admin side there is a button that calls the server, changes the Shared Object like this:
function call_fms(action, user){
conn_nc.connect(dir,action,user);
};
then the other swf has the following code
var conn_nc:NetConnection = new NetConnection();
var dir:String = "rtmp:/admin_panel";
conn_nc.onStatus = function(info) {
check_conn();
};
function check_conn() {
var counterSO = SharedObject.getRemote("control_panel", dir, true);
counterSO.onSync = function(list) {
DO_SOMETHING_HERE()
};
counterSO.connect(conn_nc);
}
conn_nc.connect(dir);
The thing I don't understand is that when I paste the user code in the admin file, well it works perfectly, but once the code is in two separate swf, they stop communicating.
So I suppose my question is how do I build a listener on one swf that is warned when the shared object is modified by another swf?
Thanks a lot guys
David
Hi guys, I'm totally new to FMS, but I already have to get down to understanding it real quick, got a dead line for next week to hand a multi conferencing system (but that's not the problem). So here is the question:
I have two similar swf, panel.swf and panel_admin.swf, they are set in the same folder on the server.
I would like them both to be watching the same serverSide object and launch a function if it changes. So the code I have is he following:
Server side
application.onAppStart = function(){
counterSO = SharedObject.get("control_panel", true)
counterSO.setProperty("user", '')
counterSO.setProperty("action", '')
}
application.onConnect = function(clientObj, action, user){
application.acceptConnection(clientObj);
if(user != undefined && action != undefined){
counterSO.setProperty("user", user)
counterSO.setProperty("action", action)
clientObj.call("check_func", null, user, action);
}else{
counterSO.setProperty("user", "")
counterSO.setProperty("action", "")
}
}
On the admin side there is a button that calls the server, changes the Shared Object like this:
function call_fms(action, user){
conn_nc.connect(dir,action,user);
};
then the other swf has the following code
var conn_nc:NetConnection = new NetConnection();
var dir:String = "rtmp:/admin_panel";
conn_nc.onStatus = function(info) {
check_conn();
};
function check_conn() {
var counterSO = SharedObject.getRemote("control_panel", dir, true);
counterSO.onSync = function(list) {
DO_SOMETHING_HERE()
};
counterSO.connect(conn_nc);
}
conn_nc.connect(dir);
The thing I don't understand is that when I paste the user code in the admin file, well it works perfectly, but once the code is in two separate swf, they stop communicating.
So I suppose my question is how do I build a listener on one swf that is warned when the shared object is modified by another swf?
Thanks a lot guys
David