Skip to main content
Inspiring
October 6, 2006
Question

Newbie Stupid Problem

  • October 6, 2006
  • 2 replies
  • 223 views
Hi All,

I'm an expirienced developer in Flash, but recently I was forced to deal
with Flash Media Server.
I'm quite excited but I have one really stupid question:

I want to have an application which will call client's function and pass a
parameter to it.

Any replies are warmly welcome!

Here is what I have :

// APPLICATION
application.onAppStart = function() {
trace("onAppStart> " + application.name + " is starting at " + new
Date());
}


application.onConnect =function(clientObj,userName, password){
trace("we are connected");
application.acceptConnection(clientObj);

//setting parametter to the client
clientObj.RedirectURL="rtmp:/appName/tesgin_new_instance";
clientObj.call("testFunction");
};

// END OF APPLICATION


// CLIENT ACTIONSCRIPT


// First, make sure an onStatus
NetConnection.prototype.onStatus = function(info){
trace("NetConnection STATUS: " + info.code);
}


nc =new NetConnection();

nc.testFunction = function(){
trace("testFunction -> nc.RedirectURL: "+this.RedirectURL);
}


if ( nc.connect("rtmp:/appName/") ){
trace("Attempting connection...");
} else {
trace("Can't attempt connection. Is the URI correct?");
}

// END OF CLIENT ACTIONSCRIPT

PROBLEM DESCRIPTION:
Cannot find the nc.RedirectURL parametter from the nc object.
Its undefined.
I've tried it with a parametter on the testFunction and display it.. along
with clientObj.call("testFunction","redirTest");
And its still not returing this string.

Please whats the problem with this code ???


    This topic has been closed for replies.

    2 replies

    Inspiring
    October 7, 2006
    Thanks Tarun,

    This really works.

    Thanks for the help,
    Martin

    "tarungupta" <webforumsuser@macromedia.com> wrote in message
    news:eg89la$ogg$1@forums.macromedia.com...
    > Use clientObj.call("testFunction",null,"redirTest"); in the server side
    > code.
    > The second parameter is the name of the callback function, which in your
    > case
    > is not there.
    >
    > Client Side
    > nc.testFunction = function(str){
    > trace("testFunction -> nc.RedirectURL: "+str);
    > }
    > I will suggest that you go through some of the basic syntax of FMS:)
    >
    > Tarun
    >
    >


    October 7, 2006
    Use clientObj.call("testFunction",null,"redirTest"); in the server side code. The second parameter is the name of the callback function, which in your case is not there.

    Client Side
    nc.testFunction = function(str){
    trace("testFunction -> nc.RedirectURL: "+str);
    }
    I will suggest that you go through some of the basic syntax of FMS:)

    Tarun