5 Replies Latest reply on May 22, 2010 10:08 AM by René Bühling

    NativeWindow drag'n'drop upper screen limit

    René Bühling Level 1

      Dear all,

       

      I noticed that it seems to be impossible to drag and drop a frameless NativeWindow to a y-coordinate < 0. The movement is started with nativeWindow.startMove(). It is possible to drag the window over the upper screen border but as soon as you release the mouse button the window jumps back.

       

      The question is:

      Can this behaviour be disabled or fixed?

       

       

      Side info:

      • It seems possible to move the window by code to a position y<0. The problem seems releated to the mouse drop.
      • I made a workaround by setting the window position explicitly (window.y = y_recored_during_NativeWindowBoundsEvent_MOVING) inside a MOUSE_UP event. This works basically for Windows.
      • The problem is even stronger on MacOS where I did not find a way to bypass it.

       

       

      Steps to recover:

       

      You may use the following function to create a test window:

       

      private function testYBug():void
      {
          var nativeWindowOptions:NativeWindowInitOptions;
          nativeWindowOptions = new NativeWindowInitOptions();
          nativeWindowOptions.type = NativeWindowType.LIGHTWEIGHT;
          nativeWindowOptions.systemChrome = NativeWindowSystemChrome.NONE;
          nativeWindowOptions.transparent = true;
          
          var s:Sprite = new Sprite();
          s.graphics.beginFill(0xFF0000);
          s.graphics.drawRect(0, 0, 200, 200);
          s.graphics.endFill();
          s.graphics.beginFill(0x00FF00);
          s.graphics.drawRect(0, 150, 200, 200);
          s.graphics.endFill();            
          
          var nw:NativeWin;
          nw = new NativeWin(nativeWindowOptions);
          nw.stage.align = "TL";
          nw.stage.scaleMode = "noScale";
          nw.width = 200; 
          nw.height = 200; 
          nw.activate();
          nw.stage.addChild(s);
          
          s.addEventListener(MouseEvent.MOUSE_DOWN, function(e:*):void { nw.startMove(); } );
      }
      

       

      The function above will create a borderless native window with a full size red square. A green rectangle is added to the bottom of the red square.

      You can move the window using drag and drop.

       

      To see the problem: Try to drop the window to a position on screen where you can only see the green rectangle.

      (This is where the window's y value is wide below 0. The red area is 'above' the upper screen border.)

       

      Thanks for your ideas and help,

      René

        • 1. Re: NativeWindow drag'n'drop upper screen limit
          thilgen

          Rene

           

          What is the NativeWin class being used in your example?

           

          Could that have some logic in it that is affecting the drag behavior?

           

          What happens if you use the built in NativeWindow class in AIR 2?

           

          Is this behavior reproduceable in AIR 1.5 or is the behavior new to AIR 2?

           

          Thanks,

           

          Chris Thilgen

          AIR Engineering

          • 2. Re: NativeWindow drag'n'drop upper screen limit
            René Bühling Level 1

            Thanks for your answer, Chris.

             

            Indeed I used the NativeWin class accidentally in the example, sorry. Anyway it was just a simple extension of flash.display.NativeWindow with few irrelevant functions (i.e. debug painting).

             

            So you can simply replace NativeWin with flash.display.NativeWindow in my example. It does not affect the problem.

             

            I tested it with Air runtimes 1.5.0.7220 and 2.0.0.12510. The behaviour is the same in both versions.

             

            Thanks,

            René

             

            Edit: typo

            • 3. Re: NativeWindow drag'n'drop upper screen limit
              lite_As_AIR Level 1

              i think that is the default behavior of any windows in the (windows O.S) (when you drag the window using .startMove() method then the content inside the window remains stationary, but the window which contains the objects is moved). Instead you can encapsulate all your graphics in a MovieClip and export it as an actionscript object by setting the linkage properties, add this object to the stage of the native window, you can then add a MOUSE_DOWN listener function which does : {(movieclipObject).startDrag(false);} and a MOUSE_UP listener function which does: {(movieclipObject).stopDrag();} now when you drag the movie clip object you can drop it anywhere on the screen even at  y<0.

               

              cheers!

              • 4. Re: NativeWindow drag'n'drop upper screen limit
                René Bühling Level 1

                lite_As_AIR wrote:

                (when you drag the window using .startMove() method then the content inside the window remains stationary, but the window which contains the objects is moved).

                 

                Right. This is what should happen and which also works fine.

                The problem is a misbehaviour of the native window itself. It is not related to the actual graphical contents (MCs, ...).

                Instead you can encapsulate all your graphics in a MovieClip and export it as an actionscript object by setting the linkage properties, add this object to the stage of the native window, you can then add a MOUSE_DOWN listener function which does : {(movieclipObject).startDrag(false);} and a MOUSE_UP listener function which does: {(movieclipObject).stopDrag();}

                 

                Does startDrag/stopDrag not only move the MC on its stage and not the native window? I could use this, but this would mean I have to create a full screen native window to be able to drag MCs on the whole desktop.

                 

                now when you drag the movie clip object you can drop it anywhere on the screen even at  y<0.

                 

                I think you can drag it anywhere on its stage. To drag it anywhere on screen a fullscreen stage, meaning a full screen nativeWindow, or a draggable native window would be required. Using a screen-size native window which is basically the easiest, leads to massive performance issues in some cases (described in this post).

                 

                Anyway, thanks for your suggestions.

                 

                I have the impression that this problem is either a bug in Air runtime or it is an well-intended 'feature' in the Air runtime which unfortunately turns out to be hindering in practice.

                • 5. Re: NativeWindow drag'n'drop upper screen limit
                  René Bühling Level 1

                  Unfortunately I did not make any progress concerning this problem and the thing seems to me to be a really strange behaviour. So I submitted a bug report using the Adobe Bug Report Form.

                   

                  Because we have to decide soon on our ongoing technical strategies in our project, ideas on solving this are still very welcome anyway.