0 Replies Latest reply on Jun 15, 2009 10:05 PM by MergGarvey

    HTML not unloading properly...


      I'm attempting my first AIR application, so bear with me if the code below is a mess - I'm learning as I go!


      What I'm trying to do is make a simple pop-up window that loads a local PDF file - I'm building a interactive CD.  The code SEEMS to work fine at first, but after I call the code a few times for new windows, instead of loading the PDF I'm asking for, it simply displays the last PDF that was loaded.

      See the code, hopefully that will illustrate what I'm trying to do.  Thank you in advance for your help.


      var ExternalWindowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
      var ExternalWindow:NativeWindow = new NativeWindow(ExternalWindowOptions);
      var ExternalWindowWidth:Number;
      var ExternalWindowHeight:Number;
      var ExternalTarget:String;
      var htmlView:HTMLLoader = new HTMLLoader();
      var ExternalWindowTitle:String;


      function runExternal(ExternalTarget:String):void {


         //create the init options
          ExternalWindowOptions = new NativeWindowInitOptions();
          ExternalWindowOptions.transparent = false;
          ExternalWindowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
          ExternalWindowOptions.type = NativeWindowType.NORMAL;
          //create the window
          ExternalWindow = new NativeWindow(ExternalWindowOptions);
          ExternalWindow.title = ExternalWindowTitle;
          ExternalWindow.width = ExternalWindowWidth;
          ExternalWindow.height = ExternalWindowHeight;
          ExternalWindow.stage.align = StageAlign.TOP_LEFT;
          ExternalWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
          htmlView.width = ExternalWindowWidth;
          htmlView.height = ExternalWindowHeight;
          htmlView.load(new URLRequest(ExternalTarget));
          ExternalWindow.addEventListener(Event.CLOSING, removeExternal);
          ExternalWindow.addEventListener(Event.DEACTIVATE, removeExternal);



      function removeExternal (e:Event):void {
          ExternalWindow.removeEventListener(Event.CLOSING, removeExternal);
          ExternalWindow.removeEventListener(Event.DEACTIVATE, removeExternal);
          ExternalWindow = null;
          var htmlView = new HTMLLoader();