<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; focusOut</title>
	<atom:link href="http://blog.flexexamples.com/tag/focusout/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Displaying a TextInput control&#8217;s text as a password in Flex (redux)</title>
		<link>http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/</link>
		<comments>http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 16:42:45 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[PopUpManager]]></category>
		<category><![CDATA[TextInput]]></category>
		<category><![CDATA[displayAsPassword]]></category>
		<category><![CDATA[focusIn]]></category>
		<category><![CDATA[focusOut]]></category>
		<category><![CDATA[removePopUp()]]></category>
		<category><![CDATA[setTimeout()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/</guid>
		<description><![CDATA[<p>We&#8217;ve already seen how to get a TextInput control to display its text as a masked password field before in an earlier example, <a href="http://blog.flexexamples.com/2008/01/05/displaying-a-textinput-controls-text-as-a-password-in-flex/">&#8220;Displaying a TextInput control&#8217;s text as a password in Flex&#8221;</a> by setting the displayAsPassword property to true.<br /> The following example will show you how you can listen for the focusIn [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve already seen how to get a TextInput control to display its text as a masked password field before in an earlier example, <a href="http://blog.flexexamples.com/2008/01/05/displaying-a-textinput-controls-text-as-a-password-in-flex/">&#8220;Displaying a TextInput control&#8217;s text as a password in Flex&#8221;</a> by setting the <code>displayAsPassword</code> property to <code>true</code>.<br />
The following example will show you how you can listen for the <code>focusIn</code> and <code>focusOut</code> events to toggle the <code>displayAsPassword</code> property so that when the password field has focus the text is displayed as plain text, and when the password field does not have focus the text is displayed as masked text.</p>
<p>Full code after the jump.</p>
<p><span id="more-484"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextInput_displayAsText_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.managers.PopUpManager;

            private var alert:Alert;

            private function submit_click():void {
                alert = Alert.show("Closing in 3 seconds.",
                                    "Submitting...");
                setTimeout(closeAlert, 3000);
            }

            private function reset_click():void {
                alert = Alert.show("Closing in 1 second.",
                                    "Resetting...");
                username.text = "";
                password.text = "";
                setTimeout(closeAlert, 1000);
            }

            private function closeAlert():void {
                PopUpManager.removePopUp(alert);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Panel title="Login"&gt;
        &lt;mx:Form&gt;
            &lt;mx:FormItem label="Username:" required="true"&gt;
                &lt;mx:TextInput id="username"
                        text="JohnDoe"
                        maxChars="16" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="Password:" required="true"&gt;
                &lt;mx:TextInput id="password"
                        text="p455w0rd"
                        maxChars="16"
                        displayAsPassword="true"
                        focusIn="password.displayAsPassword = false;"
                        focusOut="password.displayAsPassword = true;" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
        &lt;mx:ControlBar horizontalAlign="right"&gt;
            &lt;mx:Button id="submit"
                    label="Submit"
                    click="submit_click();" /&gt;
            &lt;mx:Button id="reset"
                    label="Reset"
                    click="reset_click();" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TextInput_displayAsText_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/TextInput_displayAsText_test_2/bin/main.html" width="100%" height="220"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a TextInput control\&#039;s text as a password in Flex (redux) on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/',contentID: 'post-484',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'displayAsPassword,focusIn,focusOut,removePopUp(),setTimeout()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/27/displaying-a-textinput-controls-text-as-a-password-in-flex-redux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Building a simple tip calculator in Flex</title>
		<link>http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/</link>
		<comments>http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 05:15:36 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[CurrencyFormatter]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[FormItem]]></category>
		<category><![CDATA[HSlider]]></category>
		<category><![CDATA[Slider]]></category>
		<category><![CDATA[TextInput]]></category>
		<category><![CDATA[focusIn]]></category>
		<category><![CDATA[focusOut]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/</guid>
		<description><![CDATA[<p>The following example shows a very simple (and probably somewhat buggy) tip calculator which I put together in a few minutes using Flex. Nothing really new, but sometimes its fun to combine a few of the things we&#8217;ve covered over the past posts and build something a bit more interesting.</p> <p>Full code after the jump.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows a very simple (and probably somewhat buggy) tip calculator which I put together in a few minutes using Flex. Nothing really new, but sometimes its fun to combine a few of the things we&#8217;ve covered over the past posts and build something a bit more interesting.</p>
<p>Full code after the jump.</p>
<p><span id="more-179"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TipCalculator_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function updateTotal():void {
                var amt:Number = parseFloat(amount.data.toString());
                if (isNaN(amt)) {
                    total.text = "Not a Number";
                    return;
                }
                var tipAmt:Number = amt * tip.value/100;
                total.text = currencyFormatter.format(tipAmt + amt);
            }

            private function dataTipFunc(item:Number):String {
                var amt:Number = parseFloat(amount.data.toString());
                var tipAmt:Number = amt * item/100;
                return item + "% (" + currencyFormatter.format(tipAmt) + ")";
            }

            private function amount_focusOut(evt:FocusEvent):void {
                amount.data = Number(amount.text).toFixed(2);
                amount.text = currencyFormatter.format(amount.data);
            }

            private function amount_focusIn(evt:FocusEvent):void {
                amount.text = amount.data.toString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:CurrencyFormatter id="currencyFormatter" precision="2" /&gt;

    &lt;mx:Form&gt;
        &lt;mx:FormHeading label="Tip Calculator" /&gt;
        &lt;mx:FormItem label="Amount:"&gt;
            &lt;mx:TextInput id="amount"
                    data="0"
                    restrict="0-9."
                    change="updateTotal();"
                    focusOut="amount_focusOut(event);"
                    focusIn="amount_focusIn(event);" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="Tip:"&gt;
            &lt;mx:HSlider id="tip"
                    minimum="0"
                    maximum="30"
                    value="15"
                    labels="[0,5,10,15,20,25,30]"
                    snapInterval="1"
                    tickInterval="5"
                    liveDragging="true"
                    change="updateTotal();"
                    showTrackHighlight="true"
                    dataTipFormatFunction="dataTipFunc" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="Total:" fontWeight="bold"&gt;
            &lt;mx:Label id="total" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TipCalculator_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/TipCalculator_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Building a simple tip calculator in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/',contentID: 'post-179',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'focusIn,focusOut',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/09/17/building-a-simple-tip-calculator-in-flex/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Changing a form item&#8217;s background color when a child control has focus</title>
		<link>http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/</link>
		<comments>http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 16:14:30 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Form]]></category>
		<category><![CDATA[FormItem]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[focusIn]]></category>
		<category><![CDATA[focusOut]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/</guid>
		<description><![CDATA[<p>I recently saw this on the Interwebs and thought I&#8217;d try to rebuild the effect in Flex. It is a pretty nice way to highlight the currently active form item.</p> <p>The following example shows how you can use the focusIn and focusOut events to highlight the currently focused form item.</p> <p>Full code after the jump.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>I recently saw this on the Interwebs and thought I&#8217;d try to rebuild the effect in Flex. It is a pretty nice way to highlight the currently active form item.</p>
<p>The following example shows how you can use the <code>focusIn</code> and <code>focusOut</code> events to highlight the currently focused form item.</p>
<p>Full code after the jump.</p>
<p><span id="more-187"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FormItem_backgroundColor_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        FormItem {
            paddingLeft: 4;
            paddingRight: 4;
            paddingTop: 4;
            paddingBottom: 4;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private const BACKGROUND_COLOR:Object = "haloBlue";

            private function formItem_focusIn(evt:FocusEvent):void {
                var item:FormItem = FormItem(evt.currentTarget.parent);
                item.setStyle("backgroundAlpha", 0.2);
                item.setStyle("backgroundColor", BACKGROUND_COLOR);
            }

            private function formItem_focusOut(evt:FocusEvent):void {
                var item:FormItem = FormItem(evt.currentTarget.parent);
                item.setStyle("backgroundColor", null);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Form&gt;
        &lt;mx:FormItem label="First name:"&gt;
            &lt;mx:TextInput id="firstName"
                    focusIn="formItem_focusIn(event);"
                    focusOut="formItem_focusOut(event);" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="Last name:"&gt;
            &lt;mx:TextInput id="lastName"
                    focusIn="formItem_focusIn(event);"
                    focusOut="formItem_focusOut(event);" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FormItem_backgroundColor_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/FormItem_backgroundColor_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing a form item\&#039;s background color when a child control has focus on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/',contentID: 'post-187',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'focusIn,focusOut',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/09/16/changing-a-form-items-background-color-when-a-child-control-has-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

