Thursday, September 30, 2010

Flex 4 TitleWindow Manager

Update - Take a look at a updated version of the TitleWindowManager class here and a sample dashboard application here.

Here is a TitleWindow manager class that I put together to manage my CustomTitleWindows. It is basically the same as the MDI Manager class in the MDI framework, except my manager class works with the new TitleWindows in Flex 4. Also, my manager class only detects TitleWindows that are created by Flex's PopUpManager class. It has the following features:
  • Enforce Boundaries

    • This feature basically doesn't allow the user to drag the TitleWindow outside the bounds of the application.
    • I also added a new feature that you can turn on called "soft boundaries".  This allows the user to drag the window outside the application bounds, but then snaps back into the application once the window is let go.  The snapping back can be animated if you choose.


  • Snapping

    • This feature is exactly the way it works in the MDI framework, but I just modified it to work with the new Flex 4 TitleWindows.
    • I also added a new feature that you can turn on called "snapToEdges".  This allows the windows to not only snap to other windows, but also to the edges of the application.
I just want to note that you can use this manager class to manage regular old Flex 4 TitleWindows.  You don't need to use my CustomTitleWindow class.  This means that you could just drop in this manager class into your existing Flex application and would have to make no modifications to your existing Flex 4 TitleWindows that were created through the PopUpManager to get the functionality mentioned above.

Enough talking, click the link below to view the sample.

View Sample (right click the sample to view source)

3 comments:

  1. i want to move/drag the title window all over the screen not only in application .
    i am creating a popup like
    PopUpManager.addPopUp(objCustomerInformation,this,false);
    i want user can drag this popup over the browser
    you know how to do this..
    please help..

    ReplyDelete
  2. Have flex use the external interface api to call out to Javascript. In Javascript create the window. This would allow the user to drag the window anywhere in the browser window

    ReplyDelete
  3. will you please illustrate more..
    because i am new in flex.

    ReplyDelete