1 Reply Latest reply on Jun 6, 2011 7:44 AM by blazejewicz

    Popup only comes after the Externla Interface call is compete.

    yugma kumar agrawal

      Hi,

       

      I am calling a function define in javascript using the EternlaInterface.call method. Before the call I am trying to show a popup, below is the code

       

       

                  myProgressBar = ProgressComponent(PopUpManager.createPopUp(DisplayObject(myParent),ProgressComponent,true ));
                  PopUpManager.centerPopUp(myProgressBar);           
                                 
                  if (ExternalInterface.available) {
                  
                      returnValue = ExternalInterface.call("execute", sqlStr);                  
                  }

       

       

      But the issue here is that the popup is displayed only once the external interface.call is complete.

       

      Thanks,

      Yumga

       

       

        • 1. Re: Popup only comes after the Externla Interface call is compete.
          blazejewicz Level 4

          Hi Yumga,

           

          flash is single-threaded and all code and drawing occurs in the same thread (call it main thread). Your block of code has to be executed fully before screen is updated. So you wan't be able to see any screen update before code returns because there is no render state.

          I think that - if you want to show screen update (e.g. information to user) - you need to to either:

          - defer external call execution - so it happens after screen is updated (you could use callLater for that:

          This method accepts a function pointer as an argument. The method then puts the function pointer on a queue, so that the function is called the next time the player dispatches either a render event or an enterFrame event.

          http://livedocs.adobe.com/flex/3/html/help.html?content=performance_04.html

          - or make your external call to javascript asynchronous (by providing callback method in actionscript, etc),

           

          hth,

          kind regards,

          Peter