0 Replies Latest reply on Aug 5, 2010 8:48 AM by amandamartino

    EventListeners for multiple remote object calls

    amandamartino

      Hi all,

       

       

      I have a Flex component that is displaying content from multiple (specifically two) remote object calls. I can call both remote methods, get the results back, pass them off to their respective ItemRenderers, etc. with no trouble. What I need, though, is a way to determine if I get no results back from either function call, to dispatch an event to trigger the next view state, and I don't know how to do that. Something like:

       

      protected function ticketConfigurationStateChangeHandler(event:Event):void
                  {

                     if(getPackagePromptsResult.lastResult.length == 0 && getTicketPromptsResult.lastResult.length == 0)

                     {
                           this.dispatchEvent(new Event("ticketConfigurationStateChange"));

                     }
                  }
                 
                  protected function ticketPrompts_creationCompleteHandler(event:FlexEvent):void
                  {
                      getTicketPromptsResult.token = registrationAPI.getTicketPrompts();
                      getTicketPromptsResult.addEventListener(ResultEvent.RESULT, showTicketConfiguration);
                  }
                 
                  protected function packagePrompts_creationCompleteHandler(event:FlexEvent):void
                  {
                      getPackagePromptsResult.token = registrationAPI.getPackageCPrompts();
                      getPackagePromptsResult.addEventListener(ResultEvent.RESULT, showPackageConfiguration);
                  }

       

      Any suggestions would be greatly appreciated...I know I need the event listeners to be able to get lastResult.length (and have it not be null) but I don't know how to set them up so I can automatically pass the user through the component and onto the next one if there are no results returned without having the user click a button or something similar on an otherwise blank component.

       

      Thanks in advance!

       

      ~ Amanda