all groups > macromedia flash flashcom > may 2007 >
You're in the

macromedia flash flashcom

group:

Client."commandName" trouble



Client."commandName" trouble jmellen
5/24/2007 4:31:18 PM
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?

Re: Client."commandName" trouble abeall
5/24/2007 5:27:11 PM
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.
Re: Client."commandName" trouble jmellen
5/24/2007 5:31:52 PM
Ooops.

Re: Client."commandName" trouble B_Shack
5/24/2007 5:38:49 PM
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
Re: Client."commandName" trouble jmellen
5/24/2007 5:52:32 PM
Re: Client."commandName" trouble abeall
5/24/2007 6:12:19 PM
[quoted text, click to view]
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?
Re: Client."commandName" trouble jmellen
5/24/2007 6:50:54 PM
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.
Re: Client."commandName" trouble abeall
5/24/2007 7:56:02 PM
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);
Re: Client."commandName" trouble jmellen
5/25/2007 2:14:26 PM
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.

Re: Client."commandName" trouble abeall
5/25/2007 2:38:58 PM
[quoted text, click to view]

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.
AddThis Social Bookmark Button