0 Replies Latest reply on Oct 4, 2008 7:47 PM by slaingod

    Unusual Event Handling Priorities

    slaingod Level 1
      This may be a pretty esoteric situation, but just thought I would bring it up.

      I have an application that uses events to show a particular component and hide the rest. Showing and hiding also triggers transition effects like fade in/out for the components that appear/disappear.

      One of these components deals with loading an external AS2 SWF using javascript. If for some reason that load fails, there is am ExternalInterface.addCallBack registered method that gets called by javascript, that is supposed to then show some other component and hide the rest, indicating the failure.

      The issue I am seeing is that the method that handles the setting of the component visibilities is getting interrupted by the javascript addCallBack return call from javascript.

      Essentially, what it looks like is as follows:

      1) dispatch show 'game' component event
      2) event handler sets game component to visible
      3) the onShow event for the game component immediately calls javascript to show AS2 game (the event handler has not finished yet... it still needs to try to hide the rest of the components)
      4) The javascript AS2 game loader immediately fails (div missing, swfobject failure, etc.) and calls the callback function.
      5) Before execution finished of the original event handler, the callback asynchronously does all of its handling and dispatches another show/hide components event
      6) This brand new event is process and handled IMMEDIATELY, and the handler completes
      7) The original event only now finishes processing the rest of the original handler request

      Setting the priority on the addEventListner to even something like 2147483648 does nothing to change this behavior. Any event called from addCallback handlers seem to be infinite priority.