Hey,

The client is not really an instance of the connection, but a representation of the client connected (an id in form of an obj).. Because FMS wouldn't want any client to call any function. for security reasons (otherwise you could never build anything secure on it), clients can only Call functions that are connected on the client (object that represents themself on the server).

So it's not like when you add a function at the fms to the client.. what you think is the direct connection.. that it would go tru the line to the clients pc and add it there.
(if i'm guessing your thoughts right) :)

With kind regards,

Dennis
I Sioux

----- Original Message ----- From: "[p e r c e p t i c o n]" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, August 09, 2007 12:51 AM
Subject: Re: [Flashcoders] fms application class


hey Andy,
thanks, yes this helps alot...i was confused about the client having the
definition and conceptually i still don't get what's remote about it...the
clientObj is an instance of the connection right? and that's instantiated
on the client-side right?...anyway as long as it works i'm not going to
quibble too much :)

p



On 8/8/07, Andy Herrman <[EMAIL PROTECTED]> wrote:

The only way for a client to call a method is for that method to exist
on the Client's object.  That's just the way the Flash RPC stuff
works.  You can either add it to the Client prototype (which I don't
like) or add it to the client object after they connect (my preferred
way).

For instance:

application.onConnect = function(oClient, oParams) {
  this.acceptConnection(oClient);
  oClient.helloServer = function() {
    trace("Hello Server");
  };
}

Or, you can get fancy and do some delegate-style work so that your
actual function is defined on application (or some other object):

application.helloServer = function() {
  trace("Hello Server");
}

application.onConnect = function(oClient, oParams) {
  this.acceptConnection(oClient);
  oClient.oScope = this;
  oClient.helloServer = function() {
this.oScope.helloServer.apply(this.oScope, arguments); };
}

The reason you're getting an error about the function not existing is
that it doesn't.  When the client makes a call the server looks for a
function of the given name on the client's object.  If it doesn't
exist you get an error.

I hope that helps!

  -Andy

On 8/8/07, [p e r c e p t i c o n] <[EMAIL PROTECTED]> wrote:
> hi Andy,
> the server logs indicate that the method isn't defined...
>
> however if i define it using Client.helloServer = function()
>
> it seems to work, but my concern is that this isn't really remote...i
want
> the client to call the application's method
>
> thanks
>
>
> p
>
> On 8/8/07, Andy Herrman <[EMAIL PROTECTED]> wrote:
> >
> > Your syntax looks fine. What do you mean by "it isn't recognized as > > a
> > method"?
> >
> >   -Andy
> >
> > On 8/8/07, [p e r c e p t i c o n] <[EMAIL PROTECTED]> wrote:
> > > Hi folks,
> > >
> > > i know htis isn't the fms list, but can anyone tell how to define a
> > method
> > > in the asc file... for example
> > >
> > > i tried to define a method like this
> > >
> > > application.helloServer = function()
> > > {
> > >     trace("hello from server");
> > > }
> > >
> > > but it isn't recognized as a method...
> > >
> > > i'm trying to not have to define it on the client side as a member
of
> > the
> > > NetConnection object...
> > >
> > >
> > > thanks
> > >
> > > p
> > > _______________________________________________
> > > [email protected]
> > > To change your subscription options or search the archive:
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > > Brought to you by Fig Leaf Software
> > > Premier Authorized Adobe Consulting and Training
> > > http://www.figleaf.com
> > > http://training.figleaf.com
> > >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to