<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Creating custom dialog boxes using the PopUpManager and TitleWindow classes</title>
	<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 10:40:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-14699</link>
		<author>peterd</author>
		<pubDate>Thu, 14 Aug 2008 14:12:43 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-14699</guid>
		<description>Craig,

Which type of events? Custom events or just the &lt;code&gt;close&lt;/code&gt; event?

Peter</description>
		<content:encoded><![CDATA[<p>Craig,</p>
<p>Which type of events? Custom events or just the <code>close</code> event?</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-14694</link>
		<author>Craig</author>
		<pubDate>Thu, 14 Aug 2008 11:18:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-14694</guid>
		<description>Hi is it possible to fire events back to the parent page?  Ie from CustomTitleWindow.mxml back to View.mxml ?

Thanks

Craig</description>
		<content:encoded><![CDATA[<p>Hi is it possible to fire events back to the parent page?  Ie from CustomTitleWindow.mxml back to View.mxml ?</p>
<p>Thanks</p>
<p>Craig</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-11321</link>
		<author>Robin</author>
		<pubDate>Wed, 09 Apr 2008 01:16:07 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-11321</guid>
		<description>I was fiddling with this and wanted to pop up a component and close it with the close button.  I wanted to do something like this:



But for various reasons I didn't want the component to have a pre-defined close handler.  So I listened for the Close event and tried to close the event target, but it reported errors.  The solution was this:

&lt;pre class="code"&gt;
var audioConfig = PopUpmanagercreatePopUp(this, AudioConfig, true);
audioConfig.addEventListener(Event.CLOSE, closePopUpWindow);
...

private function closePopUpWindow(e:CloseEvent):void {
   PopUpManager.removePopUp(e.target as IFlexDisplayObject);			
}
&lt;/pre&gt;

Does the same as what you've got above, but doesn't require the name of the object being closed.</description>
		<content:encoded><![CDATA[<p>I was fiddling with this and wanted to pop up a component and close it with the close button.  I wanted to do something like this:</p>
<p>But for various reasons I didn&#8217;t want the component to have a pre-defined close handler.  So I listened for the Close event and tried to close the event target, but it reported errors.  The solution was this:</p>
<pre class="code">
var audioConfig = PopUpmanagercreatePopUp(this, AudioConfig, true);
audioConfig.addEventListener(Event.CLOSE, closePopUpWindow);
...

private function closePopUpWindow(e:CloseEvent):void {
   PopUpManager.removePopUp(e.target as IFlexDisplayObject);
}
</pre>
<p>Does the same as what you&#8217;ve got above, but doesn&#8217;t require the name of the object being closed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thom Blake</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-6629</link>
		<author>Thom Blake</author>
		<pubDate>Mon, 04 Feb 2008 18:20:43 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-6629</guid>
		<description>This pop-up seems as though it is meant to be modal.  If you add a third parameter to createPopUp, true, it makes the dialog modal, which should solve the above-mentioned keyboard focus issue.</description>
		<content:encoded><![CDATA[<p>This pop-up seems as though it is meant to be modal.  If you add a third parameter to createPopUp, true, it makes the dialog modal, which should solve the above-mentioned keyboard focus issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tron</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-6103</link>
		<author>Tron</author>
		<pubDate>Tue, 15 Jan 2008 04:39:56 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-6103</guid>
		<description>From view.MXML I want to call a function on close of the popup window to update some data int he calling component.  Any ideas?</description>
		<content:encoded><![CDATA[<p>From view.MXML I want to call a function on close of the popup window to update some data int he calling component.  Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henk</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-5957</link>
		<author>Henk</author>
		<pubDate>Thu, 10 Jan 2008 00:06:37 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-5957</guid>
		<description>Nice example. 
I found one problem. The keyboard focus is still on the underlying window. If you click on the 'launch the title window' button, then after it opened hit the spacebar, a second one will open on top of the first.</description>
		<content:encoded><![CDATA[<p>Nice example.<br />
I found one problem. The keyboard focus is still on the underlying window. If you click on the &#8216;launch the title window&#8217; button, then after it opened hit the spacebar, a second one will open on top of the first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-1322</link>
		<author>peterd</author>
		<pubDate>Fri, 07 Sep 2007 15:28:52 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-1322</guid>
		<description>Rajesh,

I'm not sure about MVC, but off the top of my head I'd imagine the easiest way to track whether a window is open is by using a boolean. Otherwise, depending on how your popups are created, maybe set the popup to null when created or closed and then initialize the popup variable just before the popup gets created. That way you could always check to see if the popup is open by checking to see whether the variable is null or not.
And because that was a terrible explanation, I figure it could be something along these lines:

&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.containers.TitleWindow;
            import mx.controls.Text;
            import mx.events.CloseEvent;
            import mx.managers.PopUpManager;

            private var popUpWin:TitleWindow;

            private function initPopUpWin():void {
                var txt:Text = new Text();
                txt.percentWidth = 100;
                txt.selectable = false;
                txt.text = "The quick brown fox jumped over the lazy dog.";

                popUpWin = new TitleWindow();
                popUpWin.title = "Title";
                popUpWin.width = 160;
                popUpWin.height = 120;
                popUpWin.showCloseButton = true;
                popUpWin.addEventListener(CloseEvent.CLOSE, closePopUp);
                popUpWin.addChild(txt);
            }

            private function createPopUp():void {
                if (!popUpWin) {
                    initPopUpWin();
                    PopUpManager.addPopUp(popUpWin, this);
                    PopUpManager.centerPopUp(popUpWin);
                }
            }

            private function closePopUp(evt:CloseEvent):void {
                PopUpManager.removePopUp(popUpWin);
                popUpWin = null;
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:Button label="Launch TitleWindow" click="createPopUp();" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Happy Flexing!

Peter</description>
		<content:encoded><![CDATA[<p>Rajesh,</p>
<p>I&#8217;m not sure about MVC, but off the top of my head I&#8217;d imagine the easiest way to track whether a window is open is by using a boolean. Otherwise, depending on how your popups are created, maybe set the popup to null when created or closed and then initialize the popup variable just before the popup gets created. That way you could always check to see if the popup is open by checking to see whether the variable is null or not.<br />
And because that was a terrible explanation, I figure it could be something along these lines:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.TitleWindow;
            import mx.controls.Text;
            import mx.events.CloseEvent;
            import mx.managers.PopUpManager;

            private var popUpWin:TitleWindow;

            private function initPopUpWin():void {
                var txt:Text = new Text();
                txt.percentWidth = 100;
                txt.selectable = false;
                txt.text = "The quick brown fox jumped over the lazy dog.";

                popUpWin = new TitleWindow();
                popUpWin.title = "Title";
                popUpWin.width = 160;
                popUpWin.height = 120;
                popUpWin.showCloseButton = true;
                popUpWin.addEventListener(CloseEvent.CLOSE, closePopUp);
                popUpWin.addChild(txt);
            }

            private function createPopUp():void {
                if (!popUpWin) {
                    initPopUpWin();
                    PopUpManager.addPopUp(popUpWin, this);
                    PopUpManager.centerPopUp(popUpWin);
                }
            }

            private function closePopUp(evt:CloseEvent):void {
                PopUpManager.removePopUp(popUpWin);
                popUpWin = null;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Button label="Launch TitleWindow" click="createPopUp();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Happy Flexing!</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajesh Bhadra</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-1264</link>
		<author>Rajesh Bhadra</author>
		<pubDate>Fri, 07 Sep 2007 06:57:56 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-1264</guid>
		<description>Hey, can you tell me how we can open a popup only once without creating a modal window. I m working on a project in which there are lotsa pop-ups..I want to open them only once.I am using a MVC architecture for my project. Is there any simpler way without referring a static variable inside a model...</description>
		<content:encoded><![CDATA[<p>Hey, can you tell me how we can open a popup only once without creating a modal window. I m working on a project in which there are lotsa pop-ups..I want to open them only once.I am using a MVC architecture for my project. Is there any simpler way without referring a static variable inside a model&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DEfusion</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-423</link>
		<author>DEfusion</author>
		<pubDate>Fri, 24 Aug 2007 08:50:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-423</guid>
		<description>What if my custom component that I want to use as a popup is in it's own directory (and thus has it's own namespace) I can't seem to get it working when I have that setup. The only way I can get the popup to work is if the custom component is in the root of my app.

Any ideas?</description>
		<content:encoded><![CDATA[<p>What if my custom component that I want to use as a popup is in it&#8217;s own directory (and thus has it&#8217;s own namespace) I can&#8217;t seem to get it working when I have that setup. The only way I can get the popup to work is if the custom component is in the root of my app.</p>
<p>Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John C. Bland II</title>
		<link>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-307</link>
		<author>John C. Bland II</author>
		<pubDate>Tue, 21 Aug 2007 01:59:53 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/20/creating-custom-dialog-boxes-using-the-popupmanager-and-titlewindow-classes/#comment-307</guid>
		<description>Peter, we built a large Flex app and had a need for popups and I have to say it was super nice to be able to do just what you're doing for a custom solution. Flex def' rocks for popups!</description>
		<content:encoded><![CDATA[<p>Peter, we built a large Flex app and had a need for popups and I have to say it was super nice to be able to do just what you&#8217;re doing for a custom solution. Flex def&#8217; rocks for popups!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
