2 Replies Latest reply on Feb 16, 2009 6:42 PM by drillnaut

    ExternalInterface HTTPSercvice

    drillnaut
      Hello Everyone,
      I have a function that sends data to the backend on browser close. When I set the function to be triggered by the closing of the browser (ExternalInterface.addCallback("myFlexFunction",sendAnalyticsAS);), it doesn't work. I know the function works because if I call it at other times in the code it sends the data. However when I debug, the debugger steps all the way through the function's code , even past "httpservice.send(params)" however the backend receives nothing. What could I be doing wrong ... other than being dumb.

      Sincerely,
      JDall
        • 1. Re: ExternalInterface HTTPSercvice
          Level 7

          "drillnaut" <webforumsuser@macromedia.com> wrote in message
          news:gn04pm$3m1$1@forums.macromedia.com...
          > Hello Everyone,
          > I have a function that sends data to the backend on browser close. When
          > I
          > set the function to be triggered by the closing of the browser
          > (ExternalInterface.addCallback("myFlexFunction",sendAnalyticsAS);), it
          > doesn't
          > work. I know the function works because if I call it at other times in
          > the
          > code it sends the data. However when I debug, the debugger steps all the
          > way
          > through the function's code , even past "httpservice.send(params)" however
          > the
          > backend receives nothing. What could I be doing wrong ... other than
          > being
          > dumb.

          You've called it after the ActiveX control has been destroyed.

          Try calling it onBeforeUnload.


          • 2. Re: ExternalInterface HTTPSercvice
            drillnaut Level 1
            Turns out that you can't actually depend on the whole ExternalInterface thing to trigger something to send data even when set to be called on onbeforeunload. I basically have to make the app continuously report the data back to a servlet, and do a mark and sweep protocol to determine if the recorded information should be written to the database or await further updates.