For everybody who's interested.
Passing objects to the client with the invoke method can be done this way:
SERVER:
=======
import java.util.HashMap;
import java.util.Map;
....
....
public void invokeAtClient() {
IConnection conn = Red5.getConnectionLocal();
IServiceCapableConnection service = (IServiceCapableConnection) conn;
Map<String, String> oReturn = new HashMap<String, String>();
oReturn.put("key1", "test");
oReturn.put("key2", "test 2");
oReturn.put("key3", "test 3");
service.invoke("svr2swfCall", new Object[] { oReturn },this);
}
FLASH:
======
In flash bind the method to the Netconnection object and access the
dataobject (evtObj) as follows:
public function svr2swfCall(evtObj:Object):Void {
trace(evtObj[key1]);
trace(evtObj[key2]);
trace(evtObj[key3]);
}
Ruben
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
> Ruben Waitz
> Verzonden: zaterdag 3 februari 2007 10:58
> Aan: [email protected]
> Onderwerp: [Red5] server invoke method with Object argument
>
> Hello,
>
> When I invoke an client-function from a server-app with an "Object"
> containing three strings only the first array-position is received by the
> client. In my example below it's "string1".
>
> Does anyone know how to fix this?
>
> (I'am using Red5_0.6_rc1-WAR with Tomcat 5)
>
> Thanks!
>
> Ruben
>
>
>
> Code snippets:
>
> SERVER CODE (e.g. Application.java):
> ===========================
> @Override
> public boolean appConnect(IConnection conn, Object[] params) {
> ((IServiceCapableConnection) conn).invoke ("svr2swfCall", new Object[] {
> "string1", "string2", "string3" }, this);
> return true;
> }
>
>
> CLIENT CODE (AS):
> ================
> import org.red5.net.Connection;
> .....
> nc = new Connection();
> nc.svr2swfCall= Delegate.create(this, svr2swfCall);
> nc.connect( uri ); // etc
> .....
> public function svr2swfCall(evtObj:Array):Void {
> // _global.Xray.xrayLogger.debug("svr2swfCall", evtObj);
> trace (evtObj[0] + "\n" + evtObj[1] + "\n" + evtObj[2]); // Problem:
> only
> data for "evtObj[0]" is received......!
> }
>
>
>
> ------------------------------------
> www.red5tutorials.net: Tutorials - How tos - FAQ
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
------------------------------------
www.red5tutorials.net: Tutorials - How tos - FAQ
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org