I've been trying to dumb this down to a very simple connection so I can
understand it. Here's what I have so far:
In Application.java:
public ISharedObject so;
@Override
public boolean appStart(IScope app) {
// same as onAppStart on FMS
appScope = app;
createSharedObject(app, "media", true);
so = getSharedObject(app, "media");
return true;
}
public boolean setSOAttribute(String name, Object value) {
return so.setAttribute(name, value); // true if worked, false if not
}
public String getSOAttribute(String name) {
return (String) so.getAttribute(name); // returns object as a string
}
In the Flash actionscript for the Flash movie that sets the value:
nc_video = new NetConnection();
nc_video.connect("rtmp://<url>");
so = SharedObject.getRemote("media", nc_video.uri);
so.connect(nc_video);
sourceListener = new Object();
source_group.addEventListener("click", sourceListener);
sourceListener.click = function(event) {
var selectedButton = source_group.selection;
so.data.message_area = selectedButton.data; //works to set value
and onSync is called on all clients
//nc_video.call("setAttribute", null, "message_area",
selectedButton.data); // works to set value on server, but no onSync
//nc_video.call("setSOAttribute", null, "message_area",
selectedButton.data); // works to set value on server, but no onSync
};
In Flash actionscript of movie that receives update:
so = SharedObject.getRemote("media", nc_video.uri);
if(so.connect(nc_video)){
trace("here");
};
remote_so.synchronized = false;
SharedObject.prototype.onSync = function(list) {
for (var i = 0; i < list.length; i++) {
switch (list[i].code ) {
case "change":
... do something
}
}
};
Thanks for any insight you might have.
Bill
Sascha wrote:
>Interalab Sales schrieb:
>
>
>> If I use the following to set the value of the SO element, the
>>element value is successfully set, but onSync is never called in the client:
>>
>> nc.call("setAttribute", null, "elementName ", selectedButton.data);
>>
>>Question: is that expected behavior?
>>
>>
>>
>>
>>
>onSync should have been called each time when datas for one of those
>(remote, locale) sharedObject changes
>
>could u show more of your code?
>
>greetz
>Sascha
>
>
>
>_______________________________________________
>Red5 mailing list
>[email protected]
>http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org