1 Reply Latest reply: Oct 15, 2010 7:14 AM by Ronsweb RSS

    Flash Remoting Responder

    Ronsweb

      I am trying to make different method calls to a coldfusion cfc using flash remoting.  I am having problems calling a different function

      with a second responder.  Here is what I am trying to do:

       

      //Flash Remoting
      import flash.net.*;
      import fl.controls.TextArea;


      var gateway:NetConnection = new NetConnection();
      var responder:Responder=new Responder(onResult,onFault); 
      var responderImgSize:Responder=new Responder(onResultSecondFunction//is this possible???,onFault);

       

      //I have two calls

      //Will Work

      gateway.call("stream.components.tvcomponent.setHitCount", responder, vID);

       

      //Will NOT work because of the function call is not onResult

      gateway.call("stream.components.tvcomponent.getImageSize", responderImgSize, channelID,vID);

       

      I would like to make the second Responder call another function "onResultSecondFunction"  besides onResult.  Is this possible?

       

      Thanks.

       

      Ron

        • 1. Re: Flash Remoting Responder
          Ronsweb Community Member

          I finally figured out the solution.  I had to create a class to handle the second responder.

           

          Here is the Class:

           

          package com.hitmanage
          {
             import flash.net.*;

              public class ManageHitCount
              {
                  public function ManageHitCount(videoID:String = "0")
                  {
               vID = videoID;
                  }
                 
                  public var vID:String;
                 
                  public function addHit():String
                  {
                      var result:String;
            
                 var gateway:NetConnection = new NetConnection();
                       var responder:Responder=new Responder(onResult,onFault); 
              gateway.connect("http://localhost/flashservices/gateway/");
             gateway.call("stream.components.tvcomponent.setHitCount", responder, vID);
                    
                   //   if (vID != null && vID.length > 0)
                     // {
                      //    result = "Hello there, " + vID + ".";
                     // }
                     // else
                     // {
                          //result = "Hello there, anonymous.";
                     // }
                      return result;
                  }
           
             function onResult(responds:Object):void { 
                    }
           
             function onFault(responds:Object):void { 
                    }
              }
          }

          ------------------------------------------------------------------------------------------ ----

          .FLA:

           

           

          import com.hitmanage.ManageHitCount;

           

            var hitCountAdd:ManageHitCount = new ManageHitCount(vID);
            var hitcountReturn:String = hitCountAdd.addHit();

           

          -----------------------------------

           

          Hope this helps

           

          Ron