MM in their infinite wisdom erased the answer to this question in the FCS 1.5 forum, so I need to ask it again: I have written the following code to PUSH urls from a combo box.. The combo box and local SO updates fine, but the other clients don't recieve the the URL anyone know what I'm doing wrong? Client side: but.useHandCursor=false; but.onRelease = function() { chat.clearHistory(); } simpleconnect.main_nc.onStatus = function(info) { trace(info.code); } av1_mc.onStartPublish = function() { av1audio_mc.publish(av1_mc.local_mic,av1_mc.ns,100 ); } av1_mc.onStopPublish = function() { av1audio_mc.stopPublish(); } av1_mc.onStartReceive = function() { av1audio_mc.receive(av1_mc.ns); } av1_mc.onStopReceive = function() { av1audio_mc.stopReceive(); } av2_mc.onStartPublish ...
MM in their infinite wisdom erased the answer to this question in the FCS 1.5
forum, so I need to ask it again:
I have written the following code to PUSH urls from a combo box.. The combo
box and local SO updates fine, but the other clients don't recieve the the URL
anyone know what I'm doing wrong?
Client side:
but.useHandCursor=false;
but.onRelease = function() {
chat.clearHistory();
}
simpleconnect.main_nc.onStatus = function(info) {
trace(info.code);
}
av1_mc.onStartPublish = function() {
av1audio_mc.publish(av1_mc.local_mic,av1_mc.ns,100 );
}
av1_mc.onStopPublish = function() {
av1audio_mc.stopPublish();
}
av1_mc.onStartReceive = function() {
av1audio_mc.receive(av1_mc.ns);
}
av1_mc.onStopReceive = function() {
av1audio_mc.stopReceive();
}
av2_mc.onStartPublish = function() {
av2audio_mc.publish(av2_mc.local_mic,av2_mc.ns,100 );
}
av2_mc.onStopPublish = function() {
av2audio_mc.stopPublish();
}
av2_mc.onStartReceive = function() {
av2audio_mc.receive(av2_mc.ns);
}
av2_mc.onStopReceive = function() {
av2audio_mc.stopReceive();
}
av3_mc.onStartPublish = function() {
av3audio_mc.publish(av3_mc.local_mic,av3_mc.ns,100 );
}
av3_mc.onStopPublish = function() {
av3audio_mc.stopPublish();
}
av3_mc.onStartReceive = function() {
av3audio_mc.receive(av3_mc.ns);
}
av3_mc.onStopReceive = function() {
av3audio_mc.stopReceive();
}
av4_mc.onStartPublish = function() {
av4audio_mc.publish(av4_mc.local_mic,av4_mc.ns,100 );
}
av4_mc.onStopPublish = function() {
av4audio_mc.stopPublish();
}
av4_mc.onStartReceive = function() {
av4audio_mc.receive(av4_mc.ns);
}
av4_mc.onStopReceive = function() {
av4audio_mc.stopReceive();
}
// Open connection to the server
client_nc = new NetConnection();
// define event handler for messages
client_nc.onStatus = ncStatus;
// event handler for messages
function ncStatus(nsObj) {
trace("NC> " +nsObj.code);
}
local_so = SharedObject.getLocal("SavedURLs", "/");
// Connect to the chat application, and specific instance
client_nc.connect("rtmp://210.48.93.94/push");
// Call remote SharedObject
my_so = SharedObject.getRemote("server_side_shared_object" ,client_nc.uri,true);
my_so.connect(client_nc);
populateUrlCombo();
// define event handler for SharedObject Update
function handle_update(){
getURL(newURL,"_blank");
trace("updating");
for(var prop in this.data){
trace(prop+" of value: "+this.data
[prop]) };
}
// assign event handler for SharedObject Update
my_so.onSync = handle_update;
// simple button that when pushed writes input from text box
// to the SharedObject. The FCS Updates it's copy and notifies
// all connected clients.
//push_btn.onRelease = function()
//{ my_so.data.broadcast_url = url_cb.text;
//}
// read the content of a local shared object and populates the combobox with it
function populateUrlCombo() {
var j = 0;
if (local_so.data.lastvisited != undefined) {
url_cb.removeAll();
for (var i=0; i<10; i++) {
if (local_so.data["saved_"+i] != undefined) {
url_cb.addItem(local_so.data["saved_"+i]);
if (local_so.data.lastvisited == local_so.data["saved_"+i]) {
this.lastVisitedIndex = j;
}
j++;
}
}
url_cb.setSelectedIndex(this.lastVisitedIndex);
}
}
function doSend() {
//save new data in local_so
var newURL = url_cb.getValue();
var exists = false;
for (var i=0; i<10; i++) {
var theUrl = local_so.data["saved_"+i];
if (theUrl == newURL) {
exists = true;
break;
}
}
if (!exists) {
// manual shift
for (var i=9; i>=0; i--) {
local_so.data["saved_"+(i+1)] = local_so.data["saved_"+i];
}
//add at the top
trace("Saving :"+ newURL + " to local_so");
local_so.data["saved_0"] = newURL;
}
local_so.data.lastvisited = newURL;
local_so.flush();
populateUrlCombo();
}
stop();
Server Side:
// Application instance startup
application.onAppStart = function(){
// create a server side SharedObject
server_side_shared_object = SharedObject.get("my_SS_SO",false);
}
application.onConnect = function(client){
// accept connection
application.acceptConnection(client);
}
application.onDisconnect = function(client){
// put in some client disconnect code.
}
Bookmarks