Hi,
I tried any way to communicate with another extension in server side AS, but I always get the same error:
----------------------------------------------------------
[MainExt.as]: extension found? it.gotoandplay.smartfoxserver.extensions.Javascri
ptExtension@1e85adf
22:31:42.945 - [ INFO ] > { DATA OUT } : <msg t='xt'><body action='xtRes' r='-1'
><![CDATA[<dataObj><var n='r' t='x' /><var n='m' t='s'>[MainExt.as]: Does it hav
e a method? function handleInternalRequest() {/*
java.lang.Object handleInternalRequest(java.lang.Object)
*/}
</var><var n='_cmd' t='s'>trace</var><var n='z' t='s'>CardGamesZone</var></dataO
bj>]]></body></msg>
[MainExt.as]: Does it have a method? function handleInternalRequest() {/*
java.lang.Object handleInternalRequest(java.lang.Object)
*/}
org.mozilla.javascript.EvaluatorException: Can't find method it.gotoandplay.smar
tfoxserver.extensions.JavascriptExtension.handleInternalRequest(). (MainExt.as#1
627)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultError
Reporter.java:109)
-------------------------------------
As you can see from the first line, I can successfully locate the other extension, and it gets traced. Also, I try to trace the method, and it successfully locates it. BUT whenever I try to call the same method (that just traced successfully) it never works.
thanks
Filippo
Extension interoperability not working in server AS
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Sure here it is,
it's part of a OOP-like fraework implemented in server side js, so it may not be too clear... anyway all extension inherit from this.
It's supposed to call a custom method in the desired extension, but since it wasn't working I tried calling handleInternalRequest() directly.
If you look at the trace statements,
the first 2 are traced (extension, and method found), the third, which invokes the method, doesnt execute and triggers an error.
thanks a lot!
it's part of a OOP-like fraework implemented in server side js, so it may not be too clear... anyway all extension inherit from this.
Code: Select all
System.prototype.callExtension = function(extName, method, par) {
trace ("calling extension: "+extName+"."+method+"() " + this._zone);
this._ext = this._zone.getExtension(extName);
trace ("extension found? "+this._ext);
trace ("Does it have a method? " + this._ext.handleInternalRequest);
trace ("Letrs call it: "+this._ext.handleInternalRequest());
if (par) return this._ext.handleInternalRequest(par);
else return this._ext.handleInternalRequest();
}
It's supposed to call a custom method in the desired extension, but since it wasn't working I tried calling handleInternalRequest() directly.
If you look at the trace statements,
the first 2 are traced (extension, and method found), the third, which invokes the method, doesnt execute and triggers an error.
thanks a lot!