4 Replies Latest reply on Feb 2, 2011 10:27 AM by kevinklin

    s:TitleWindow Boundary

    gilson.carvalho Level 1

      I have an s: TitleWindow and configured it like this:

      isPopUp = true; // To stay afloat and draggable
      includeInLayout = false; // not to occupy space in the layout

      This window is inside a panel, I need it to be only
      dragged to the edge of the panel, it can not leave from within the
      I searched on Google, and is somewhat related Boundary (not sure).



      [Sorry my bad english]

        • 1. Re: s:TitleWindow Boundary
          Flex harUI Adobe Employee

          That's not really supported.  You might be better off copying some of the

          dragging code and modifying it.

          • 2. Re: s:TitleWindow Boundary

            Hi Harl UI. I have the custom Title Window. I tried  to implement dragging, it  works fine when I use the below code in the application where I  used this custom component . But I am unable to scroll on the datagrid inside this titlewindow container. Because where ever I click on the Titlewindow and move my mouse the whole titlewindow is moving. But I want  this dragging on the titlewindow's top portion. In the creatincomplete handler I used




            addeventListener(Event.Mousedown, fn1);

            addeventListener(Event.MouseUp, fn2);













            isPopup=true; also is not working.Please help me on this.Thanks in advance.

            • 3. Re: s:TitleWindow Boundary
              Pablo Souza Level 3

              Hi Gilson,


              I believe you wanna clip the content to the boundaries of the Panel container.

              It looks like you understand Portuguese, so you can see this post http://rectius.com.br/blog/?p=652 in my blog.

              You can also download the source code of the project there.


              Just to let everybody updated, you are gonna need set the property "clipAndEnableScrolling" to "true".

              It's is in every class inherited from BaseGroup.


              Let me know if you can solve your problem now.


              Best regards,

              Pablo Souza

              • 4. Re: s:TitleWindow Boundary
                kevinklin Adobe Employee



                I believe you're looking for something like:


                <?xml version="1.0" encoding="utf-8"?>
                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
                            import spark.events.TitleWindowBoundsEvent;
                            protected function titlewindow1_windowMovingHandler(event:TitleWindowBoundsEvent):void
                                // These are the new bounds when the window is moved.
                                // You can modify them to alter the result of when the TitleWindow moves.
                                // Remember that since the TitleWindow is a child of the Panel, the 
                                // coordinates are relative to the Panel's content.
                                var endBounds:Rectangle = event.afterBounds;
                                // left edge of the panel's contentGroup
                                if (endBounds.x < 0)
                                    endBounds.x = 0;
                                // right edge of the panel's contentGroup
                                if ((endBounds.x + endBounds.width) > panel.width)
                                    endBounds.x = panel.width - endBounds.width;
                                // top edge of the panel's contentGroup
                                if (endBounds.y < 0)
                                    endBounds.y = 0;
                                // bottom edge of the panel's contentGroup
                                if ((endBounds.y + endBounds.height) > panel.height)
                                    endBounds.y = panel.height - endBounds.height;
                    <s:Panel id="panel" width="500" height="600" x="100" y="100">
                        <s:TitleWindow windowMoving="titlewindow1_windowMovingHandler(event)"
                                       isPopUp="true" includeInLayout="false" width="100" height="100" />



                Basically, the "windowMoving" event is fired whenever the TitleWindow is dragged around. It provides the bounds before and after the move (see ASDoc for TitleWindowBoundsEvent). You can modify those in a handler to get the effect you want. Let me know if this helps or you need more information.