<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Closing a pop up window using the keyboard in Flex</title>
	<atom:link href="http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sat, 11 Feb 2012 11:51:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anonymous</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-7458</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 08 Apr 2010 05:46:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-7458</guid>
		<description>use the following method in init() function.
 this.setFocus();</description>
		<content:encoded><![CDATA[<p>use the following method in init() function.<br />
 this.setFocus();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mr A</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3615</link>
		<dc:creator>Mr A</dc:creator>
		<pubDate>Thu, 09 Apr 2009 13:11:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3615</guid>
		<description>Simon,

I think you need

    if (event.charCode == Keyboard.ESCAPE) {

instead of

    if (Keyboard.ESCAPE) {

as this seems to close the popup/title window or whatever on any key press, not just ESCAPE !!!

And the reason is  &quot;if (Keyboard.ESCAPE)&quot;  will always be true as Keyboard.ESCAPE is a keyboard key value and therefore non-zero. Actually an ASCII value for ESCAPE.
see http://livedocs.adobe.com/flex/3/langref/flash/ui/Keyboard.html</description>
		<content:encoded><![CDATA[<p>Simon,</p>
<p>I think you need</p>
<p>    if (event.charCode == Keyboard.ESCAPE) {</p>
<p>instead of</p>
<p>    if (Keyboard.ESCAPE) {</p>
<p>as this seems to close the popup/title window or whatever on any key press, not just ESCAPE !!!</p>
<p>And the reason is  &#8220;if (Keyboard.ESCAPE)&#8221;  will always be true as Keyboard.ESCAPE is a keyboard key value and therefore non-zero. Actually an ASCII value for ESCAPE.<br />
see <a href="http://livedocs.adobe.com/flex/3/langref/flash/ui/Keyboard.html" rel="nofollow">http://livedocs.adobe.com/flex/3/langref/flash/ui/Keyboard.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3619</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Thu, 12 Mar 2009 00:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3619</guid>
		<description>Hm sorry, the first line was wrong, here the korrekt one -&gt;  initialize=&quot;titleWindow_keyDown()&quot;</description>
		<content:encoded><![CDATA[<p>Hm sorry, the first line was wrong, here the korrekt one -&gt;  initialize=&#8221;titleWindow_keyDown()&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3618</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Thu, 12 Mar 2009 00:11:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3618</guid>
		<description>Hi

Thanks for the Code, but i think its better if you take an EventListener.

To the  Tag the line -&gt;  initialize=&quot;titleWindow_keyDown()

Than a new function:
&lt;pre class=&quot;code&quot;&gt;
private function titleWindow_keyDown():void {
     stage.addEventListener(KeyboardEvent.KEY_DOWN, pressKey);
}
&lt;/pre&gt;

And a second function:
&lt;pre class=&quot;code&quot;&gt;
private function pressKey(event:KeyboardEvent):void{
    if (Keyboard.ESCAPE) {
        close();    // call your close-function
    }
}
&lt;/pre&gt;

Now you should be able to call this keyboard function every time - equal what focus are set

Simon</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>Thanks for the Code, but i think its better if you take an EventListener.</p>
<p>To the  Tag the line -&gt;  initialize=&#8221;titleWindow_keyDown()</p>
<p>Than a new function:</p>
<pre class="code">
private function titleWindow_keyDown():void {
     stage.addEventListener(KeyboardEvent.KEY_DOWN, pressKey);
}
</pre>
<p>And a second function:</p>
<pre class="code">
private function pressKey(event:KeyboardEvent):void{
    if (Keyboard.ESCAPE) {
        close();    // call your close-function
    }
}
</pre>
<p>Now you should be able to call this keyboard function every time &#8211; equal what focus are set</p>
<p>Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: João Paulo Braga</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3614</link>
		<dc:creator>João Paulo Braga</dc:creator>
		<pubDate>Sun, 11 Jan 2009 15:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3614</guid>
		<description>Thank you, it was exactly what I was looking for. Great piece of code.</description>
		<content:encoded><![CDATA[<p>Thank you, it was exactly what I was looking for. Great piece of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3609</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Tue, 18 Nov 2008 14:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3609</guid>
		<description>&lt;a href=&quot;http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-16778&quot; rel=&quot;nofollow&quot;&gt;flex-newbie&lt;/a&gt;,

I&#039;d try using the &lt;code&gt;focusIn&lt;/code&gt; and &lt;code&gt;focusOut&lt;/code&gt; methods on the form field.

Peter</description>
		<content:encoded><![CDATA[<p><a href="http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-16778" rel="nofollow">flex-newbie</a>,</p>
<p>I&#8217;d try using the <code>focusIn</code> and <code>focusOut</code> methods on the form field.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: flex-newbie</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3607</link>
		<dc:creator>flex-newbie</dc:creator>
		<pubDate>Tue, 18 Nov 2008 14:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3607</guid>
		<description>Pete,

thanks for all the example and it really helps.

how do I make a popup help window which contains some help information on a particular field, but closes automatically when user clicks the mouse some other fields.  More or less like google maps balloon type functionality.

I was not able to find a way to catch the mouse event anywhere else functionality in flex.
Do you have an example for it.
thanks</description>
		<content:encoded><![CDATA[<p>Pete,</p>
<p>thanks for all the example and it really helps.</p>
<p>how do I make a popup help window which contains some help information on a particular field, but closes automatically when user clicks the mouse some other fields.  More or less like google maps balloon type functionality.</p>
<p>I was not able to find a way to catch the mouse event anywhere else functionality in flex.<br />
Do you have an example for it.<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhilash</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3605</link>
		<dc:creator>Abhilash</dc:creator>
		<pubDate>Tue, 18 Nov 2008 05:53:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3605</guid>
		<description>I have a form designed using Flex. The form does not fit the screen area and hence I am having scroll bars in it. When we click on some of the controls in the form, we open popups. But when the popup is opened, if we scroll the form using the form scroll bar then the popup is not getting scrolled. I want the popup to be scrolled along with the form elements. Please let me know how this can be done.

Thanks

Abhilash</description>
		<content:encoded><![CDATA[<p>I have a form designed using Flex. The form does not fit the screen area and hence I am having scroll bars in it. When we click on some of the controls in the form, we open popups. But when the popup is opened, if we scroll the form using the form scroll bar then the popup is not getting scrolled. I want the popup to be scrolled along with the form elements. Please let me know how this can be done.</p>
<p>Thanks</p>
<p>Abhilash</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web Hustler</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3606</link>
		<dc:creator>Web Hustler</dc:creator>
		<pubDate>Wed, 13 Aug 2008 09:56:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3606</guid>
		<description>Works on my Mac Safari.</description>
		<content:encoded><![CDATA[<p>Works on my Mac Safari.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan</title>
		<link>http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/comment-page-1/#comment-3608</link>
		<dc:creator>Dylan</dc:creator>
		<pubDate>Fri, 08 Aug 2008 19:48:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/04/closing-a-pop-up-window-using-the-keyboard-in-flex/#comment-3608</guid>
		<description>Once the focus is taken away from the Flash you can&#039;t regain focus by simply clicking the within the swf.  Instead you have to click into a component that is properly set to accepts click events like a button or input field.  You probably could somehow set the Application to test for mouse events in the case of the screen being disabled by an Alert window.  In this case everything is disabled except for the close button so the close button is the only item that can.  This is working about as well as it can.  In a real app you would being doing things like Ctrl+S to intiate a save function and there will be plenty of things to click to get focus back.

This approach works for me with XP on IE 7 and Firefox 2.</description>
		<content:encoded><![CDATA[<p>Once the focus is taken away from the Flash you can&#8217;t regain focus by simply clicking the within the swf.  Instead you have to click into a component that is properly set to accepts click events like a button or input field.  You probably could somehow set the Application to test for mouse events in the case of the screen being disabled by an Alert window.  In this case everything is disabled except for the close button so the close button is the only item that can.  This is working about as well as it can.  In a real app you would being doing things like Ctrl+S to intiate a save function and there will be plenty of things to click to get focus back.</p>
<p>This approach works for me with XP on IE 7 and Firefox 2.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

