0 Replies Latest reply on Oct 30, 2008 9:55 AM by wpdster

    How to do some work at exit of Flex app

    wpdster
      Hello,
      I'm brand new to Flex development and am attempting to modify some code that I have inherited. The Flex application (built with Flex Builder 3) communicates with a Python application via AMF. I would like to send a "shutdown" message to the Python application when I exit the Flex application. Does anybody have any recommendations as to how I might do this?

      I have defined an "exitPythonApplication()" function in my python application, and I can invoke that function from the Flex application when I click a button. Now I would like to either
      a) Exit the Flex application when I click that button.

      or

      b) Call the Python function when I click on the close window X.
      -- I've figured out that I can call that function by adding a 'windowCloseHandler()' which gets attached to the 'Event.CLOSING' event. But the AMF message never gets sent to my Python application when I close the Flex application. Actually, it does get sent if I step through with the debugger. So I theorize that there are some underlying threads which post the message to the Python application when I am single stepping through the debugger, that don't get to run when the application runs at full speed.

      Perhaps there is some way in the 'windowCloseHandler()' to yield to other threads that might be running, but I don't know how.

      I would appreciate any pointers anybody can give me on how to accomplish this. Thanks.

      --wpd