1 Reply Latest reply: Jun 12, 2013 7:45 AM by JasonBrownAA RSS

    Calling a remoteObject when browser closes?

    JasonBrownAA

      I've been able to "trap" the browser close event in the Flex code (handleLogout method below), but this call to my remote object method : sendFeedbackToSupport : is never called, even after I attempt to introduce some delay with another dummy method call and a long loop to delay the closing of the browser. It's like the remoteObject itself is detroyed before I can call a method on it.

       

      any ideas?

       

       

       


      ExternalInterfaceUtil.addExternalEventListener("window.onbeforeunload", handleLogout, "unloadFlex");

       

       

          private function handleLogout():void{
                      // jbrown 6/3/13. let's automate the sending of the logs upon logout as well
         
                          // add station to user name, contents of update log to feedback
                 
                     
                          var user:String = loggedInUser.userId+" " + loggedInUser.station;
                          var feedback:String = "END USER SESSION LOG DUMP\n\n"+alertChartsContainer.updateLog.txtUpdate.text;
                         
                          //intelliGateRemoteObject.sendFeedbackToSupport("Jason.Brown@aa.com",
                          //    "INTELLIGATE " + loggedInUser.userId+ " " +loggedInUser.station + "- " + loggedInUser.carrier+" END SESSION DUMP",
                      //        user+"\n\n"+feedback);
                           callAnotherFunction(user,feedback);
                         
                          var i:int;
                          for (i=0; i<1000000; i++)
                              trace(i);
                         
                      
                         
                  }

        • 1. Re: Calling a remoteObject when browser closes?
          JasonBrownAA Community Member

          I should note that the above code behaves the same way when I uncomment the direct call to the remoteObject, as well as when I place the method call in the "dummy" method itself:

           

              private function callAnotherFunction(user:String,feedback:String):void {
                          intelliGateRemoteObject.sendFeedbackToSupport("Jason.Brown@aa.com",
                                  "INTELLIGATE " + loggedInUser.userId+ " " +loggedInUser.station + "- " + loggedInUser.carrier+" END SESSION DUMP",
                                      user+"\n\n"+feedback);
                      }