3 Replies Latest reply on Oct 22, 2009 12:59 PM by ZeKid

    Dragging a TitleWindow is jerky when many are opened

    ZeKid Level 1

      Hello guys,

       

      I'm using a custom minimizable popup (extends TitleWindow) to simulate a "desktop window behavior" inside the browser.

      It allows the user to have several projects opened at the same time (each popup instance contains the info of a specific project) and to switch from one to another by minimizing and restoring the various popup instances.

       

      It's working well except for this:  When I drag a popup around while other instances are opened (in restored state), the dragging is very jerky, and it gets worse with the number of opened instances.  It seems the FlashPlayer is working very hard so the screen isn't updated very often.  Why should dragging a TitleWindow over other TitleWindow instances should be more intense than over the main app window ?  I've replaced my custom popup with a regular TitleWindow and the behavior is the same, so I know it has nothing to do with the custom component as such.

        • 1. Re: Dragging a TitleWindow is jerky when many are opened
          ZeKid Level 1

          ( to finish my post, which I posted to soon, by mistake...  )

           

          I've noticed that if the other popup instances have their visible property set to false, everything is fine, so it really has to do with the rendering.

           

          Is the only way around this is to create a buffer image of what's underneath the moving window and somehow place that image under it while it moves ?

          (this could be triggered on the titleBar mouseDown event, before dragging starts).  I use to do that in Java ( with two threads ) but I dunno how to do it in AS.

           

          I hope their is a simpler way, like pretending the other windows are invisible, even if they are not ....  

           

          Thanks in advance for any clue !

          • 2. Re: Dragging a TitleWindow is jerky when many are opened
            Flex harUI Adobe Employee

            Use the profiler to see what is taking all the time.  It might just be a factor of how many display objects are on the screen.  You can try replacing minimized popups with a single display object so all of its controls aren't still on the display list.

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui

            • 3. Re: Dragging a TitleWindow is jerky when many are opened
              ZeKid Level 1

              Ok ..., I found just the little trick I was looking for:  properties mouseEnabled and mouseChildren.  That does it ...

              If I set these properties to false for let say, the first 2 windows, than I can drag a third window over them, nice and smooth ... just as if the first 2 window were invisible.

               

              It seems that what's eating the CPU is the mouseListeners of the windows plus all the mouseListeners of all the many children components in each window.  Well ..., I'll remember that one for when I want to improve performance ...

               

              So all I have to do now, is:  On the titleBar mouseDown event of the window, I set these properties to false for all the other window instances.  On mouseUp, I set them back to true.