9 Replies Latest reply: Jul 4, 2012 10:32 PM by kglad RSS

    externalinterface crashing browsers

    dan_steeby Community Member

      Hi,

       

      I have a client that wanted a flash slideshow that would go to various pages on her website when clicked.  I'm using externalinterface to call a simple window.location(url, "_self") within the browser.  Half of the time the browser hangs for about 2 seconds and then loads the page.  CPU usage spikes during those 2 seconds so something's going on.  The other half of the time the browser hangs for a while (30 seconds) CPU spike the whole time, and eventually I get the following Unresponsive Script warning:

       

      A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

       

      Script: resource://firebug/firebug-service.js:4290

       

       

       

      I use firebug on Firefox as a debugger for development, but have tried disabling firebug to see if that was the root of the problem, and the problem persists without the plugin installed . . .  This problem is also happening in all the other major browsers.  When firebug IS enabled, I get the following errors in it's console:

       

       

      too much recursion

       

      jQuery is not defined

       

      (the "jQuery is not defined" then is repeated over and over a couple hundred times . . . )

       

      Choosing to stop the script doesn't stop the browser from hanging.  Instead the Unresponsive Script warning pops up again after another 30 second hang.  Even if the browser DOES manage to load the page that the window.load() call through the ExternalInterface, the browser continues to hang, even on the next page.  I'm using jQuery on the page to manage some drop-down menues, and it's otherwise not interacting with Flash in any way (the javascript call through ExternalInterface is not using jQuery, the window.open() is a basic javascript function that doesn't need jQuery to run).

       

      Any thoughts? 

       

      Here is my code:

       

      private function stage_clicked(e:MouseEvent):void{ // IF THE CLICK MAKES IT TO THE STAGE, USER IS CLICKING ON AN AD, NOT A BUTTON . . .

           e.stopImmediatePropagation();  // STOP MOUSE CLICK PROPOGATION

           try {

                if (ExternalInterface.available){

                     ExternalInterface.call("window.open","www.yahoo.com", "_self");

                } else {

                     trace("no external interface available.");

                }

           } catch (e:Error) {

                trace("error: " + e.message);

           }

      }