2 Replies Latest reply on Sep 1, 2009 6:13 AM by gammajack

    Is it possible to read a var from within openedWindows?

    gammajack

      I have a public var in every <mx:Window file that I want to read while looping through open windows so I can only act on certain types of windows.

       

      The following code works when the curser is not focused on any specific item in the window.

       

      private function read_window_type():void{

           for ( var i:Number=0; i < NativeApplication.nativeApplication.openedWindows.length; i++ ){

                // breaks when focus is on something more specific

                trace(ObjectUtil.toString(NativeApplication.nativeApplication.openedWindows[i]['stage'][' focus']['descriptor']['document']['window_type']));

           }

      }

        • 1. Re: Is it possible to read a var from within openedWindows?
          babo_ya Level 3

          Yes it is possible.. but, I would not do this way..

           

          I would create an interface.. like... has X variable interface and have all window implement that interface.

          and you can treat all window as hasX variable type.

           

          BaBo,

          1 person found this helpful
          • 2. Re: Is it possible to read a var from within openedWindows?
            gammajack Level 1

            Thanks for the feedback, babo_ya.   I am going your suggested route of implementing a common interface across my windows, but I was able to extend the <mx:window> component and add a public variable to it.  I was then able to read that variable using the NativeApplication.nativeApplication.openedWindows array, but i had issues with this array because the variable was not available in the <mx:WindowedApplication> class.  I tried to extend this class, and succeeded, but I received some odd compiler errors regarding an <mx:states> implementation I had within the new custom windowed application class.

             

            Has anyone attempted to extend WindowedApplication with success?