Here's some sample code to get started...

The TitleWindow component should be defined as its own separate 
class; for instance, assume this file is named SimpleDialog.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml"; 
width="400" height="400"
  title="My Dialog Box">
  <!-- Display a simple Label control -->
  <mx:Label text="Welcome to my Dialog Box"/>
  <mx:Label text="Try dragging me around the screen"/>
</mx:TitleWindow>

To create a Popup Dialog from this class, use this Application code:

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple application to demonstrate TitleWindow layout -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
  backgroundColor="#FFFFFF">

    <mx:Script>
       <![CDATA[
       //Import required classes
        import mx.containers.TitleWindow;
        import mx.managers.PopUpManager;
                         
       //Declare dialog box reference variable global to application
        var dialog:TitleWindow;
       
       //Open a dialog box
       function showWindow() {
         dialog=TitleWindow(PopUpManager.createPopUp( 
          this, SimpleDialog, false));
         dialog.centerPopUp();
         closeButton.enabled=true;
       }
                         
       //Close a dialog box
       function closeWindow() {
         dialog.deletePopUp();
         closeButton.enabled=false;
       }
                                 
      ]]>
    </mx:Script>

    <mx:Panel title="Simple Panel">
      <mx:Button id="openButton"
        label="Click to view dialog box" click="showWindow();"/>
      <mx:Button id="closeButton" width="{openButton.width}"
        label="Click to close dialog box" click="closeWindow()"
        enabled="false"/>
    </mx:Panel>

</mx:Application>

David Gassner
Schooner Technical Media

> The problem is that the TitleWindow in your example still takes up 
space
> in the application window.  I need it to behave like a normal 
popup.
> 
> 
> /******************************************
> * Jeff Beeman
> ******************************************/
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Jeff Tapper
> Sent: Thursday, May 12, 2005 11:27 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Internal popups
> 
> try this:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
>          <mx:Button click="toggleVis()" label="click me"/>
>          <mx:TitleWindow id="tw" title="Some title">
>                  <mx:Label text="hi there"/>
>          </mx:TitleWindow>
>          <mx:Script>
>          <![CDATA[
>                  function toggleVis(){
>                          tw.visible = !tw.visible;
>                  }
> 
>          ]]>
>          </mx:Script>
> </mx:Application>
> 
> At 02:21 PM 5/12/2005, you wrote:
> >I can't find an example or description of how to use the 
TitleWindow 
> >component without it being in an external file.  Any pointers?
> >
> >
> >
> >/******************************************
> >* Jeff Beeman
> >******************************************/
> >
> >----------
> >From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> 
> >Behalf Of Tracy Spratt
> >Sent: Thursday, May 12, 2005 10:45 AM
> >To: flexcoders@yahoogroups.com
> >Subject: RE: [flexcoders] Internal popups
> >
> >You probably want the TitleWindow component.
> >
> >Tracy
> >
> >
> >----------
> >From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> 
> >Behalf Of Jeff Beeman
> >Sent: Thursday, May 12, 2005 12:56 PM
> >To: flexcoders@yahoogroups.com
> >Subject: [flexcoders] Internal popups
> >
> >I've been scouring the documentation, but I can't seem to find 
how to
> do 
> >something that should be quite simple.  How do I create a popup 
window 
> >that doesn't reference an external file?  All examples point to 
loading
> in 
> >an external mxml file, but I would like to simply create a panel 
that
> is 
> >hidden on startup and have it hide / unhide on different events.  
Is
> this 
> >possible?
> >
> >
> >
> >/*******************************************
> >* Jeff Beeman
> >* Digital Media & Instructional Technologies
> >* Arizona State University
> >*******************************************/
> >
> >
> >
> >
> >----------
> >Yahoo! Groups Links
> >    * To visit your group on the web, go to:
> >    * 
> >
> 
<http://groups.yahoo.com/group/flexcoders/>http://groups.yahoo.com/gr
oup
> /flexcoders/ 
> >
> >    *
> >    * To unsubscribe from this group, send an email to:
> >    * 
> >
> <mailto:[EMAIL PROTECTED]
subject=Unsubscribe>flexc
> [EMAIL PROTECTED] 
> >
> >    *
> >    * Your use of Yahoo! Groups is subject to the 
> > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
> 
> 
> 
>  
> Yahoo! Groups Links




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to