3 Replies Latest reply on Dec 11, 2006 11:38 AM by Howoong

    Redrawing before calling ExternalInterface.call ( )

      When a button component (named btn_Connect here) is clicked,
      I would like to display a message in a Label (lbl_Status here),
      before calling a long-running fscommand() function.

      But there is no action until the fscommand() is finished.

      How can I do?


      A part of my ActionScript code is below.
      My flash application has only single frame.

        • 1. Re: Redrawing before fscommand
          TimSymons Level 1
          Since you are import the ExternalInterface class you don't have to use the FSCommand. you should just use the call() statement, like this:

          ExternalInterface.call("sayHello", "browser");

          "sayHello" : this would be the name of the JS function you want to call
          "browser" : this is just a string you could pass to the funciton.

          You will also be able to receive data back from the JS function directly, like this:

          greeting = String(ExternalInterface.call("sayHello", "browser"));

          Whatever you placed in a "return" statement in the function "sayHello" would be stored in the Flash variable "greeting.

          This was taken directly from the Help files. This might help with the updating.

          • 2. Re: Redrawing before calling ExternalInterface.call ( )
            Howoong Level 1
            Thanks, Tim.

            As you suggested, I changed my code to use ExternalInterface.call ( ), instead of using fscommand ( ).

            I can feel this is much faster than using fscommand ( ), but it does not solve my original problem.

            This AS code interacts with C# app embedding a Shockwave Flash Object (as an ActiveX control).
            I did put Application.DoEvents() before entering long-running operation in C#.
            In debugging mode, it works sometimes, however, it is of no use in realtime (release) mode.

            Any other suggestion?

            Thanks in advance,
            • 3. Re: Redrawing before calling ExternalInterface.call ( )
              Howoong Level 1
              To redraw the flash and process other possible user interface events,
              I changed my C# code so that the long running task can run in a separate thread.

              Now everything works fine as I expected.