3 Replies Latest reply on Jun 21, 2010 11:20 AM by USA Jon

    Flex Remote Object method reuse

    USA Jon

      Each remote object method has 1 return function. I need to call the method, and pass in a state, which returns the cities for that state. If I want to call this function for 2 different states and display them in different lists, how do I change where the return function calls so I can bind the second return data with a different variable than the first?

        • 1. Re: Flex Remote Object method reuse
          daslicht Level 2

          Hi,

          probably you could call the remoteFunction using different CallResponder.

           

          Never tried it with the RemoteObject since I now use the flex dataservices

           

          Something like:

          private var artistService:ArtistsService  = new ArtistsService();
          
          private var getAllArtistsResult      : CallResponder = new CallResponder();
                      getAllArtistsResult.addEventListener(ResultEvent.RESULT,getAllArtistsResult_Handler);
                      getAllArtistsResult.token = artistService.getAllArtists();
          
          private var createArtistsResult                               : CallResponder = new CallResponder();
                      createArtistsResult.addEventListener(ResultEvent.RESULT,createArtistsResult_resultHandler);
                      createArtistsResult.token = artistService.createArtists(item);
          

           

           

           

           

          Hope that helps in some way.

          Marc

          1 person found this helpful
          • 2. Re: Flex Remote Object method reuse
            cheftimo Level 2

            Here is an example:

             

            <mx:RemoteObject id="srvc"
                  destination="ColdFusion"
                  source="wg.products.CFCs.cyber.Catalog"
                  showBusyCursor="true" >
                  <mx:method name="getCatalog" result="productServiceResultHandler(event)">
                        <mx:arguments>
                              <theCatID>{currentCatID}</theCatID>
                        </mx:arguments>
                  </mx:method>
                  <mx:method name="getFavesList" result="idListResultHandler(event)">
                        <mx:arguments>
                              <idList>{faveString}</idList>
                        </mx:arguments>
                  </mx:method>
                  <mx:method name="getSubCatalog" result="subCatalogResultHandler(event)"/>
                  <mx:method name="getCategoryList" result="categoryListHandler(event)"/>
            </mx:RemoteObject>
            
            

             

            In this case, in method ‘getCatalog’, if you wanted to get the catalog for a different ‘currentCatID’, you would change the value stored in ‘currentCatID’.