4 Replies Latest reply on Aug 10, 2008 4:57 PM by Admiral_Brodnack

    NativeWindowType

    kiarash.M
      hi, how to work with this Class: NativeWindowType
      to have app without taskbar and system chrome ..

      tanQ .. ..
        • 1. Re: NativeWindowType
          duncanhall Level 1
          var options:NativeWindowInitOptions = new NativeWindowInitOptions();
          options.type = NativeWindowType.LIGHTWEIGHT;
          options.systemChrome = NativeWindowSystemChrome.NONE;

          var win:NativeWindow = new NativeWindow( options );
          • 2. NativeWindowType
            kiarash.M Level 1
            TanQ .. but it not work
            i have taskbar again ... /:)
            this my file ...



            package {
            // Import Flash classes
            import flash.display.*;
            import flash.display.NativeWindow;
            import flash.events.*;
            import flash.text.TextField;
            import flash.net.*;
            import flash.desktop.*;
            import flash.filesystem.*;
            import flash.utils.*;






            public class clock extends MovieClip {





            function mosalastY(ang:Number) {
            return -80 * Math.sin(ang * Math.PI / 180) + 92;
            }
            function mosalastX(ang:Number) {
            return 80 * Math.cos(ang * Math.PI / 180) + 92;
            }


            function moveWin(e:MouseEvent):void {
            stage.nativeWindow.startMove();
            }
            public function clock():void {



            //-------set clock Point -------------------
            for (var i:int=0; i < 366; i+= 6) {
            var newCircle:kia=new kia ;
            newCircle.x=mosalastX(i);
            newCircle.y=mosalastY(i);
            this.addChild(newCircle);
            }


            stage.nativeWindow.alwaysInFront=true;
            //-----------------------------------------------------------------------------********** ******
            var options:NativeWindowInitOptions=new NativeWindowInitOptions ;
            options.type=NativeWindowType.LIGHTWEIGHT;
            options.systemChrome=NativeWindowSystemChrome.NONE;
            var win:NativeWindow=new NativeWindow(options);
            //-------------------------------------------------------------------------------******** ********
            budy.addEventListener(MouseEvent.MOUSE_DOWN,moveWin);
            budy.addEventListener(MouseEvent.MOUSE_WHEEL,onMouseWheel);
            curent_date.text=date.todayDate()[2];
            function timer() {
            var thisD:Date=new Date ;
            min_a.rotation=thisD.getMinutes() * 6;
            hour_a.rotation=thisD.getHours() * 30 + thisD.getMinutes() * 6 / 60;
            sec_a.rotation=thisD.getSeconds() * 6 + thisD.getHours() * 30 / 12 + thisD.getMinutes() * 6 / 720;


            }
            var time:uint=setInterval(timer,100);
            function onMouseWheel(e:MouseEvent):void {
            var delta:int=e.delta < 0?-1:1;
            if (root.alpha >= .1 || e.delta > 0) {
            root.alpha+= delta / 50;
            }
            if (root.alpha >= 1.019) {
            root.alpha=1.019;

            }
            }
            }

            }
            }
            • 3. Re: NativeWindowType
              kiarash.M Level 1
              help me PLZ ...
              • 4. Re: NativeWindowType
                Admiral_Brodnack Level 1
                You have two windows here.

                The first window is the one automatically created by AIR using the window properties in the application descriptor file. Since you cannot set the window type in the descriptor, this window will always be of type NORMAL. You cannot change the initialization options after a window is created.

                The second window you create, with a variable named "win." You never put anything in this window nor do you ever make it visible.

                To do what you want, you have to create another class as the main application class. Move the code you added to create the window into the constructor of this new class. Then create an instance of your clock class and add it to the stage:

                var options:NativeWindowInitOptions=new NativeWindowInitOptions ;
                options.type=NativeWindowType.LIGHTWEIGHT;
                options.systemChrome=NativeWindowSystemChrome.NONE;
                var win:NativeWindow=new NativeWindow(options);

                win.stage.stageAlign=StageAlign.TOP_LEFT;
                win.stage.stageScaleMode=StageScaleMode.NO_SCALE;

                var clockInstance:clock = new clock();
                win.stage.addChild(clockInstance);
                win.activate();
                this.nativeWindow.close(); //close the launching window

                Also note that you will have to wait for your clock class to be added to the stage before accessing the window, so you would have to move this line:
                stage.nativeWindow.alwaysInFront=true;
                To an added to stage event handler.

                Have a look at the quick start applications provided by Adobe: http://www.adobe.com/devnet/air/flash/quickstart/

                There are several covering window topics.