0 Replies Latest reply on Sep 20, 2010 4:01 AM by blacksyforce

    stage vs NativeApllication.nativeApplication.activeWindow.stage

    blacksyforce Level 1

      Hy, I have one awkward problem... first, what is the difference between NativeApllication.nativeApplication.activeWindow.stage and stage ?

       

      So, I have a windowed application that first thing it does is becoming is closing the window and opens another one so it won't appear in the taskbar. Next it creates a variable named database that creates a Table (if it doesn't exist) and dispatches an Event("TableCreated"). After that it reads some data from the table and dispatches another Event("DataLoaded'). My strange problem is that in order to work my addListeners() function must look like this:

       

      private function addListeners():void

      {

           stage.addEventListener("TableCreated", eventLoadData);

           NativeApplication.nativeApplication.activeWindow.stage.addEventListener("DataLoaded", eventDrawData);

           NativeApplication.nativeApplication.activeWindow.addEventListener(Event.CLOSE, eventCloseApplication);

      }

       

      So why must I use stage.addEventListener for the first one and NativeApplication.nativeApplication.activeWindow.stage.addEventListener for the second one ? If I try anyway else it doesn't catch the dispatched event...

       

       

       

      private function createChromlessWindow():void

      {

           stage.nativeWindow.close();

           var options:NativeWindowInitOptions = new NativeWindowInitOptions();

       

           options.type = NativeWindowType.UTILITY;

           options.systemChrome = NativeWindowSystemChrome.NONE;

           options.transparent = true;

       

           var window:NativeWindow = new NativeWindow(options);

       

           window.x = Screen.mainScreen.bounds.width - 310;

           window.y = 20;

       

           window.height = 210;

           window.width = 310;

       

           window.stage.align = "TL";

           window.stage.scaleMode = "noScale";

       

           window.activate();

      }