macromedia flash flashcom:
I seem to be having trouble with what should be simple remote AS calls. Nothing I've tried has worked and I've followed the models provided in the Adobe documentation. My server script consists of this: application.onConnect (client, other params) { ... client.FunctionName = function () { trace ("This should be working"); } ... } My client side is this: ncObject.call("FunctionName",null); Anyone else had similar problems or see something dumb I'm missing?
Well, for one thing, you have a syntax error: application.onConnect (client, other params) { should be: application.onConnect = function(client, other params) { Check your application logs. It should give you syntax errors like this.
If you are not receiving any errors when the application connects, when are you calling the function? Is it before you receive the Connect.Success? If so, then the function call will not execute since the client was not accepted. Use an onStatus event handler to call the function. __nc = new NetConnection(); __nc.onStatus = function(info){ switch(info.code){ case "NetConnection.Connect.Success" : __nc.call("FunctionName", null); break; } } __nc.connect("rtmp://myconnection.com") Regards, Shack
[quoted text, click to view] > That was a typo when entering my example code.
Ah, I should have guessed by the "oher params" argument, but at any rate, please copy paste your actual code. What does the resultObject on the server give you?
Here is my server code: application.onConnect = function (client, username, position, firstName, lastName) { application.acceptConnection(client); client.recordStart = function () { trace ("Record Start"); }; } and my client code: cfPresentation.cfNCLive.call("recordStart",null); The actual program is huge but cfPresentation.cfNCLive is my NetConnection. I'm not currently passing a result object but I've tried that in the past and it hasn't returned anything.
That looks okay to me, but I'm not that experienced with FMS. Two things, though: 1) Try assigning the function to the Client prototype(outside your application functions/events) instead of directly on the client. Client.prototype.recordStart = function () { trace ("Record Start"); }; 2) By response object, I mean see what onStatus gives you: var resultObj = {}; resultObj.onStatus = function(info){ trace(info.code); } cfPresentation.cfNCLive.call("recordStart",resultObj);
Alas, no luck. I tried creating a prototype but it too does not get called. The response object also neverr gets called or returns a status message.
[quoted text, click to view] > The response object also neverr gets called or returns a status message.
That's pretty strange. Is this your server or are you using a hosting solution(like influxis.com)? It seems you are doing everything right, so I have to wonder if something strange is going on with your server configuration. Sorry I couldn't help.
Don't see what you're looking for? Try a search.
|