5 Replies Latest reply on Oct 5, 2010 6:41 AM by RandomReado

    How to disable the titlewindow dragable ?

    Benoitcn Level 1

      At some point I wanna disable the dragable function. How should I do ?

        • 1. Re: How to disable the titlewindow dragable ?yo
          *Prashant Shelke* Level 4

          u can use event.prevenDefault on dragEnter event

          1 person found this helpful
          • 2. Re: How to disable the titlewindow dragable ?yo
            Muzak Level 3

            u can use event.prevenDefault on dragEnter event


            That is meant for drag and drop operations. Won't work for a TitleWindow being dragged as far as I know.

             

            One way to stop a TitleWindow from being moved is to store the x and y position of the TitleWindow, listen for MoveEvent.Move and reset its position.

             

             

            <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" creationComplete="windowInit();">
             
             <mx:Script>
              <![CDATA[
               
               import mx.events.MoveEvent;
               
               private var oldX:Number;
               private var oldY:Number;
               
               //-------------------------------------------------------------------------
               // windowInit()
               //-------------------------------------------------------------------------
               private function windowInit():void {
                trace("Window ::: windowInit");
                oldX = x;
                oldY = y;
                addEventListener(MoveEvent.MOVE, winMoveHandler);
               }
               
               //-------------------------------------------------------------------------
               // winMoveHandler()
               //-------------------------------------------------------------------------
               private function winMoveHandler(evt:MoveEvent):void {
                trace("Window ::: winMoveHandler");
                x = oldX;
                y = oldY;
               }
               
              ]]>
             </mx:Script>
             
            </mx:TitleWindow>
            

             

            There might be other/better ways to do it, but the above works

            1 person found this helpful
            • 3. Re: How to disable the titlewindow dragable ?
              abc159abc

              Hello,

               

              Inserting the following in your titlewindow will block the movement permanently:

               

              override public function move(x:Number, y:Number):void
              {
                   return;

              }

              • 4. Re: How to disable the titlewindow dragable ?
                flex2008 Level 3

                set the isPopUp property of titlewindow to false.

                • 5. Re: How to disable the titlewindow dragable ?
                  RandomReado Level 1

                  Setting isPopUp to false works for me! Thanks!