2 Replies Latest reply on Mar 8, 2007 8:59 AM by LugiaMX

    Draggable window/panel?

    LugiaMX
      Hi, I wonder is there any way to do this: when an user clicks on a button in my Flex application, a layout, such as Panel, containing textbox and buttons will be created. However, different to a Panel layout, this layout can be dragged around (even better if it has Close, Maximize button like a normal window). I tried all layout in the Components list but it seems that none can do that.
      Can anyone please help me with this? Thank you very much.
        • 1. Re: Draggable window/panel?
          theLoggerGuy Level 1
          Try this. It's not quite what you asked for, but you should be able to build on it nicely. It consists of two files. The first is a component. The second is an application. This will give you model pop-up window.

          Enjoy :-)

          First file: myPopUp.mlxm (MXML component based on a "TitleWindow")

          <?xml version="1.0" encoding="utf-8"?>
          <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml"
          close="PopUpManager.removePopUp(this)" showCloseButton="true"
          layout="vertical" width="300" height="300">

          <mx:Script>
          <![CDATA[

          import mx.managers.PopUpManager;

          ]]>
          </mx:Script>

          </mx:TitleWindow>

          =================================================================
          Second file: myApp.mxml (MXML application)

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:local="*">


          <mx:Script><![CDATA[

          import mx.managers.PopUpManager;

          private var myWindow: myPopUp;

          private function showMyPopUp( title: String): void
          {
          myWindow = myPopUp( PopUpManager.createPopUp( this, myPopUp, true ) );
          myWindow.title = title;
          }
          ]]></mx:Script>



          <mx:Panel title="Tree Control Example" height="75%" width="75%"
          <mx:ControlBar>
          <mx:Button label="Open my window" click="showMyPopUp('My space monkey');"/>
          </mx:ControlBar>
          </mx:Panel>
          </mx:Application>
          • 2. Re: Draggable window/panel?
            LugiaMX Level 1
            Thank you :) The TitleWindow works pretty well.