Skip to main content
Known Participant
Dec 26, 2009 7:55 PM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
    calmchessplayer
    calmchessplayerCorrect answer
    Inspiring
    Jan 1, 2010 4:20 PM UTC

    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);

    6 replies

    calmchessplayer
    Inspiring
    Dec 27, 2009 4:59 AM UTC

    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

    Translate
    Known Participant
    Dec 31, 2009 10:30 AM UTC

    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.

    Translate
    calmchessplayer
    Inspiring
    Jan 1, 2010 4:13 PM UTC

    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

    Translate