Skip to main content
Known Participant
December 26, 2009
Answered

How can I call by 3 buttons the same server function and return 3 different URLs?

  • December 26, 2009
  • 1 reply
  • 672 views

Hello everybody...

I have a question...

Can I use the same server side function to send to all clients 3 different swfURL depending on which button pressed from one of them?

If the answer is positive...how can I do it?

Please, help me...

Emiliano.

    This topic has been closed for replies.
    Correct answer calmchessplayer

    In order for the client to pickup the calls

    from the server you need create the responder object......I

    don't have how to do that right on hand but i'll look it up and get back to you


    onthe client side

    import flash.net.Responder;

    var responder:Responder = new Responder(function name);

    1 reply

    calmchessplayer
    Inspiring
    December 27, 2009

    well on the client you send a variable as a parameter for each button (maybe 1,2,3) then on the serverside have  the reciving function with an if statement for each button the if statements saying if (param==1){ send message to all clients to attach swf0}.....just simply use a combination of variables parameters if statements and  send

    Known Participant
    December 31, 2009

    Hi, calmchessplayer...

    I tried yo follow your advise but I have some problems...

    This is my script.

    Client side:

    private function serverCall (e:MouseEvent = null):void
            {
                if (e.currentTarget == swfBtn1)
                {
                    nc.call("sendURL", 1);
                    trace("Chiamata server Blocchi Logici");
                }
                else if (e.currentTarget == swfBtn2)
                {
                    nc.call("sendURL", 2);
                    trace("Chiamata server Completamento Visivo");
                }
                else
                {
                    nc.call("sendURL", 3);
                    trace("Chiamata server Analisi Visiva");
                }
            }

    Server side:

    currentClient.sendURL = function (param)
        {
            var mySWF_URL1 = "http://192.168.1.2/fms3/Logopedia/BlocchiLogici.swf";
            var mySWF_URL2 = "http://192.168.1.2/fms3/Logopedia/ComplVisivo.swf";
            var mySWF_URL3 = "http://192.168.1.2/fms3/Logopedia/Analisivisiva.swf";
            for (var i = 0; i < application.clients.length; i++)
            {
                if (param == 1)
                {
                    application.clients.call("loadOnClient", null, mySWF_URL1);
                    trace("Chiamata URL 1 attiva");
                }
                else if (param == 2)
                {
                    application.clients.call("loadOnClient", null, mySWF_URL2);
                    trace("Chiamata URL 2 attiva");
                }
                else
                {
                    application.clients.call("loadOnClient", null, mySWF_URL3);
                    trace("Chiamata URL 3 attiva");
                }
             };
        }

    Client side:

    nc.client = new Object();
    nc.client.loadOnClient = function (myParam:String

                {
                     CaricaSwf (myParam);
                     trace ("Bambino:" + myParam);
                 }

    I have this error code:

    1067: Assegnazione forzata implicita di un valore del tipo int a un tipo flash.net:Responder non correlato.

    Where is the error?

    Please...help me.

    Emiliano.

    calmchessplayer
    Inspiring
    January 1, 2010

    In order for the client to pickup the calls

    from the server you need create the responder object......I

    don't have how to do that right on hand but i'll look it up and get back to you