9 Replies Latest reply on Aug 15, 2011 11:54 AM by __Kent__

    Flex events, priorities and threads

    pbureau76

      Hello,

       

      I have been reading from several places that flex is entirely single threaded, that two pieces of code will never be executed concurently, even when using timer events, and so on...

       

      On the other hand, http://livedocs.adobe.com/flex/3/html/help.html?content=events_09.html says:

       

      Even if you give a listener a higher priority than other listeners, there is no way to guarantee that the listener will finish executing before the next listener is called. You should ensure that listeners do not rely on other listeners completing execution before calling the next listener. It is important to understand that Flash Player does not necessarily wait until the first event listener finishes processing before proceeding with the next one.

       

      Could someone explain how a listener can be called "before the previous listener is finished", if the statement regarding single threading is true???

       

       

      I am running into a very nasty bug that I can't explain unless I have a race condition between two functions accessing the same ressource inside events. It is really looking like event callbacks are executed in separated treads, which would be consitent with Adobe doc about events and priorities.

       

      Thank you in advance for any hint...

       

      Pierre