2 Replies Latest reply on Sep 21, 2006 2:44 AM by Andra Veraart

    ExternalInterface.available returns false on a Mac

    Andra Veraart

      Hi there!

      I'm triyng to get the browsers back-button to work with my flash site. The general principle is this:
      There is an index.html page containing an (not yet) hidden Iframe and the flash movie.
      The Iframe contains page A, which starts with JavaScript calling a BACK-function on the index-page.
      The BACK-function triggers an AS-function in the flash-movie that activates its own back-button, and then changes the URL of the Iframe to Page B. This causes a new History to be added to the browser.

      The flash movie now contains 5 frames (labeled in the middle of the stage) and two navigation buttons: back (Terug) and forward (Verder). Those buttons do exactly what you'd expect them to do (prevFrame and nextFrame).

      On a PC (IE) this seems to work pretty well. But on a mac nothing seems to work propperly.
      I've got a testpage at: http://www.multimediamatters.nl/test
      Here's the code I have on the first frame.

      stop();

      _root.terug.onRelease = function(){
      prevFrame();
      }

      terugF = function(){
      trace(_root._currentframe);
      if (_root._currentframe > 1){
      _root.terug.onRelease();
      }
      else {
      _root.getURL("javascript::history.go(-2)");
      }
      }

      import flash.external.*;

      var isAvailable:Boolean = ExternalInterface.available;

      var txtField2:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 300, 0, 200, 50);
      txtField2.border = true;
      txtField2.text = "ExternalInterface.available = "+isAvailable.toString();


      var methodName:String = "goHome";
      var instance:Object = null;
      var method:Function = terugF;
      var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method);

      var txtField:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 0, 0, 200, 50);
      txtField.border = true;
      txtField.text = "ExternalInterface.addCallback = "+wasSuccessful.toString();


      Somehow the ExternalInterface doesn't seem to get loaded. Any suggestions to solve this?
      Thanks in advance.

      Yours,
      Andra


      P.S.
      The condition if (_root._currentframe > 1){ doesn't work on a PC either. It always calls _root.terug.onRelease(). I can't figure out why...