0 Replies Latest reply on Feb 12, 2008 9:52 AM by sasbrw

    Timer Pause While Creating ActiveX Object

    sasbrw Level 1
      I was recently playing around with the following example of using the ExternalInterface API to communicate with ActiveX:

      http://flexpearls.blogspot.com/2008/01/flex-talking-to-activex-using.html

      In case any of the calls to ActiveX don't return quickly, I wanted to use a ProgressBar and Timer to provide visual feedback that something is happening. But I found that the Flex Timer pauses while calling ActiveX.

      To illustrate, I've simplified the Flex program in the above example and attached it below. If you run this code from within a browser and click the button, a call to the Javascript setTimeout function is initiated with a 5 second delay. While the Javascript clock is ticking, the Flex Timer is also ticking, and you can see updates to the ProgressBar. But if the setTimeout function is replaced by a new ActiveXObject statement as in the sample from the above link, and the instantiation of the ActiveX object takes some time, the Flex Timer pauses during the ActiveX instantiation; i.e., the ProgressBar does not update while the new ActiveXObject call is taking place. In order to see this, you can use the example from the link above and put a Sleep call in the constructor of the ActiveX object.

      Does anyone know why this happens, or if there's a way to keep the Flex Timer running while the call to ActiveX is taking place?

      I've read that there is a Flash Player script timeout of 15 seconds:

      ( http://livedocs.adobe.com/labs/flex3/langref/flash/errors/ScriptTimeoutError.html

      I'm not sure if that timeout is related to ExternalInterface calls, but I was able to Sleep for up to 2 minutes in the ActiveX constructor, and the Flash Player patiently waited; it never threw a ScriptTimeoutError. --Bruce