5 Replies Latest reply on Nov 7, 2007 5:28 AM by Greg Dove

    Problem with AS3 "ExternalInterface.call" in InternetExplorer

    stormmedia
      Hi,

      Explaining how the page is setup:

      I have a HTML page with 2 different AS3 Flash movies.

      The first flash movie is the main animation and sits in the middle of the screen with a large background image set into the body of the HTML.

      The second flash movie stretches 100% width/height of the screen dimensions and acts as a fade from black>to invisible.

      What I'm trying to do:

      Once the second Flash animation has faded from black to invisible it calls a JavaScript function in the HTML page to hide the div element the second flash movie is embed into (this is because the first flash movie will display a set of input boxes which the user needs to be able to type into - which they wont be able to click on if there is another flash movie overlaying the entire first movie).

      My intial solution:

      In the second Flash movie is the following code:

      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
      stop();

      // this will load the API necessary to communicate with external entities
      import flash.external.ExternalInterface;

      // call the JavaScript function
      ExternalInterface.call('myJavaScriptFunction');
      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

      ...and this works fine in Mozilla Firefox/Safari. The actionscript successfully calls the JavaScript function in the HTML page and that JavaScript function simply (at this stage displays an alert() message to show that it has been successfully called).

      Problem with IE:

      But, the moment I try this in Internet Explorer I don't get a alert() message but a JavaScript error message that says:

      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
      Code: Select all
      Line: 1
      Char: 106
      Error: 'null' is null or not an object
      Code: 0
      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

      As you can expect I'm totally confused as to what the problem could be.

      This is really urgent as it's a live project that needs to get completed immediately, so any help you may have would be greatly appreciated!

      Kind regards,

      Mark.