<?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; mx internal</title>
	<atom:link href="http://blog.flexexamples.com/tag/mx-internal/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>Always displaying the selected text in a TextInput in Flex</title>
		<link>http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/</link>
		<comments>http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/#comments</comments>
		<pubDate>Fri, 01 May 2009 06:59:29 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TextInput]]></category>
		<category><![CDATA[alwaysShowSelection]]></category>
		<category><![CDATA[getTextField()]]></category>
		<category><![CDATA[mx internal]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can get the Flex TextInput control to display the currently selected text regardless of whether it has focus by using the mx_internal namespace, the getTextField() method and the Boolean alwaysShowSelection property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/ --&#62; &#60;mx:Application name="TextInput_getTextField_alwaysShowSelection_test" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can get the Flex TextInput control to display the currently selected text regardless of whether it has focus by using the <code>mx_internal</code> namespace, the <code>getTextField()</code> method and the Boolean <code>alwaysShowSelection</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-1064"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/ --&gt;
&lt;mx:Application name="TextInput_getTextField_alwaysShowSelection_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.core.UITextField;
            import mx.controls.TextInput;

            private function init(evt:Event):void {
                var ti:TextInput = evt.currentTarget as TextInput;
                var tf:UITextField = ti.mx_internal::getTextField();
                tf.alwaysShowSelection = true;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:TextInput id="textInput"
            text="The quick brown fox jumps over the lazy dog."
            selectionBeginIndex="4" selectionEndIndex="9"
            initialize="init(event);" /&gt;
    &lt;mx:Button label="Submit" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TextInput_getTextField_alwaysShowSelection_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/TextInput_getTextField_alwaysShowSelection_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Always displaying the selected text in a TextInput in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/',contentID: 'post-1064',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'alwaysShowSelection,getTextField(),mx internal',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/2009/04/30/always-displaying-the-selected-text-in-a-textinput-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using tab stops with the TextArea control in Flex</title>
		<link>http://blog.flexexamples.com/2009/02/03/using-tab-stops-with-the-textarea-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2009/02/03/using-tab-stops-with-the-textarea-control-in-flex/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 16:36:32 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TextArea]]></category>
		<category><![CDATA[TextFormat]]></category>
		<category><![CDATA[defaultTextFormat]]></category>
		<category><![CDATA[getTextField()]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[setTextFormat()]]></category>
		<category><![CDATA[tabStops]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/02/03/using-tab-stops-with-the-textarea-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set tab stops on the Flex TextArea control by setting the tabStops property on a TextFormat object and setting the defaultTextFormat property or setTextFormat() method, or by setting the TextArea control&#8217;s htmlText property to an HTML string with a &#60;TextFormat&#62; tag.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set tab stops on the Flex TextArea control by setting the <code>tabStops</code> property on a TextFormat object and setting the <code>defaultTextFormat</code> property or <code>setTextFormat()</code> method, or by setting the TextArea control&#8217;s <code>htmlText</code> property to an HTML string with a &lt;TextFormat&gt; tag.</p>
<p>Full code after the jump.</p>
<p><span id="more-952"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application name="TextArea_tabStops_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init1():void {
                var tf:TextFormat = new TextFormat();
                tf.tabStops = [100, 200, 300, 400];

                textArea1.mx_internal::getTextField().setTextFormat(tf);
            }

            private function init3():void {
                textArea3.htmlText = "&lt;TEXTFORMAT TABSTOPS='100,200,300,400'&gt;&lt;P&gt;The quick&lt;TAB/&gt;brown fox&lt;TAB/&gt;jumps over&lt;TAB/&gt;the lazy&lt;TAB/&gt;dog.&lt;/P&gt;&lt;P&gt;The&lt;TAB/&gt;quick brown&lt;TAB/&gt;fox jumps&lt;TAB/&gt;over the&lt;TAB/&gt;lazy dog.&lt;/P&gt;&lt;/TEXTFORMAT&gt;";
            }

            private function init4():void {
                var tf:TextFormat = new TextFormat();
                tf.tabStops = [100, 200, 300, 400];

                textArea4.mx_internal::getTextField().defaultTextFormat = tf;
                textArea4.text = "The quick\\tbrown fox\\tjumps over\\tthe lazy\\tdog.\\nThe\\tquick brown\\tfox jumps\\tover the\\tlazy dog.";

                textArea4.validateNow();
                trace(textArea4.htmlText);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:TextArea id="textArea1"
            condenseWhite="true"
            width="500"
            creationComplete="init1();"&gt;
        &lt;mx:htmlText&gt;
            &lt;![CDATA[
                &lt;p&gt;The quick&lt;tab/&gt;brown fox&lt;tab/&gt;jumps over&lt;tab/&gt;the lazy&lt;tab/&gt;dog.&lt;/p&gt;&lt;p&gt;The&lt;tab/&gt;quick brown&lt;tab/&gt;fox jumps&lt;tab/&gt;over the&lt;tab/&gt;lazy dog.&lt;/p&gt;
            ]]&gt;
        &lt;/mx:htmlText&gt;
    &lt;/mx:TextArea&gt;

    &lt;mx:TextArea id="textArea2"
            condenseWhite="true"
            width="500"&gt;
        &lt;mx:htmlText&gt;
            &lt;![CDATA[
                &lt;TEXTFORMAT TABSTOPS="100,200,300,400"&gt;&lt;P&gt;The quick&lt;TAB/&gt;brown fox&lt;TAB/&gt;jumps over&lt;TAB/&gt;the lazy&lt;TAB/&gt;dog.&lt;/P&gt;&lt;P&gt;The&lt;TAB/&gt;quick brown&lt;TAB/&gt;fox jumps&lt;TAB/&gt;over the&lt;TAB/&gt;lazy dog.&lt;/P&gt;&lt;/TEXTFORMAT&gt;
            ]]&gt;
        &lt;/mx:htmlText&gt;
    &lt;/mx:TextArea&gt;

    &lt;mx:TextArea id="textArea3"
            condenseWhite="true"
            width="500"
            initialize="init3();" /&gt;

    &lt;mx:TextArea id="textArea4"
            width="500"
            initialize="init4();" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using tab stops with the TextArea control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/02/03/using-tab-stops-with-the-textarea-control-in-flex/',contentID: 'post-952',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'defaultTextFormat,getTextField(),mx internal,setTextFormat(),tabStops',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/2009/02/03/using-tab-stops-with-the-textarea-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining your Flex SDK version number</title>
		<link>http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/</link>
		<comments>http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 02:32:14 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/</guid>
		<description><![CDATA[<p>The following example shows how you can determine your Flex SDK version within a Flex application by using the internal mx_internal::VERSION property.</p> <p>You can also find the version number by doing one of the following:<br /> (a) Viewing the flex-sdk-description.xml file in your Flex SDK&#8217;s root directory:</p> &#60;?xml version="1.0"?&#62; &#60;flex-sdk-description&#62; &#60;name&#62;Flex 4.0&#60;/name&#62; &#60;version&#62;4.0.0&#60;/version&#62; &#60;build&#62;3934&#60;/build&#62; &#60;/flex-sdk-description&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can determine your Flex SDK version within a Flex application by using the internal <code>mx_internal::VERSION</code> property.</p>
<p>You can also find the version number by doing one of the following:<br />
(a) Viewing the flex-sdk-description.xml file in your Flex SDK&#8217;s root directory:</p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;flex-sdk-description&gt;
    &lt;name&gt;Flex 4.0&lt;/name&gt;
    &lt;version&gt;4.0.0&lt;/version&gt;
    &lt;build&gt;3934&lt;/build&gt;
&lt;/flex-sdk-description&gt;
</pre>
<p>(b) At a command prompt, navigate to your Flex SDK&#8217;s /bin/ directory and type <code>mxmlc -version</code>:</p>
<pre>
C:\\dev\\flexSDKs\\4.0.0.3934\\bin>mxmlc -version
Version 4.0.0 build 3934
</pre>
<p>Full code after the jump.</p>
<p><span id="more-846"></span></p>
<p class="alert">Since this example uses the mx_internal namespace, you can&#8217;t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/mx_internal_VERSION_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ --&gt;
&lt;mx:Application name="mx_internal_VERSION_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Label text="{mx_internal::VERSION}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/mx_internal_VERSION_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/mx_internal_VERSION_test/bin/main.html" width="100%" height="100"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/mx_internal_VERSION_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ --&gt;
&lt;mx:Application name="mx_internal_VERSION_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Label;

            private var lbl:Label;

            private function init():void {
                lbl = new Label();
                lbl.text = mx_internal::VERSION;
                addChild(lbl);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<p class="new">Or, you can use data binding (and not get a warning) by using the <code>use namespace</code>, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/ --&gt;
&lt;mx:Application name="mx_internal_VERSION_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            use namespace mx_internal;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Label text="{VERSION}" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining your Flex SDK version number on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/',contentID: 'post-846',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'mx internal,version',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/10/29/determining-your-flex-sdk-version-number/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating a non-editable NumericStepper control in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/17/creating-a-non-editable-numericstepper-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/17/creating-a-non-editable-numericstepper-control-in-flex/#comments</comments>
		<pubDate>Sun, 18 May 2008 02:42:21 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[NumericStepper]]></category>
		<category><![CDATA[editable]]></category>
		<category><![CDATA[inputField]]></category>
		<category><![CDATA[mx internal]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/17/creating-a-non-editable-numericstepper-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can create a non-editable Flex NumericStepper control (users cannot type numbers directly into the control, but can still use the up arrow, down arrow, and keyboard to change the value) by setting the editable property on the nested inputField TextInput control.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create a non-editable Flex NumericStepper control (users cannot type numbers directly into the control, but can still use the up arrow, down arrow, and keyboard to change the value) by setting the <code>editable</code> property on the nested <code>inputField</code> TextInput control.</p>
<p>Full code after the jump.</p>
<p><span id="more-632"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/NumericStepper_inputField_editable_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/17/creating-a-non-editable-numericstepper-control-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 checkBox_change(evt:Event):void {
                var value:Boolean = checkBox.selected;
                numericStepper.mx_internal::inputField.editable = value;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="editable:"&gt;
                &lt;mx:CheckBox id="checkBox"
                        selected="true"
                        change="checkBox_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:NumericStepper id="numericStepper"
            width="100" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/NumericStepper_inputField_editable_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/NumericStepper_inputField_editable_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a non-editable NumericStepper control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/17/creating-a-non-editable-numericstepper-control-in-flex/',contentID: 'post-632',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'editable,inputField,mx internal',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/05/17/creating-a-non-editable-numericstepper-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Determining the number of lines in a TextArea control in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/#comments</comments>
		<pubDate>Fri, 09 May 2008 06:23:54 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TextArea]]></category>
		<category><![CDATA[getTextField()]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[numLines]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can get the number of lines in a Flex TextArea control by using the getTextField() method (in the mx_internal namespace) and the numLines property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_getTextField_numLines_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.utils.StringUtil; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can get the number of lines in a Flex TextArea control by using the <code>getTextField()</code> method (in the <code>mx_internal</code> namespace) and the <code>numLines</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-617"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_getTextField_numLines_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-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[
            import mx.utils.StringUtil;

            private function textArea_change(evt:Event):void {
                callLater(updateStats, [evt]);
            }

            private function updateStats(evt:Event):void {
                var nLines:uint = textArea.mx_internal::getTextField().numLines;
                var nChars:uint = textArea.length;
                var str:String = "{0} characters; {1} lines";
                panel.status = StringUtil.substitute(str,
                                    nChars,
                                    nLines);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:String id="str" source="lorem.txt" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="width (%):"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="50"
                        maximum="100"
                        value="100"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="10" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel id="panel"
            percentWidth="{slider.value}"
            height="100%"&gt;
        &lt;mx:TextArea id="textArea"
                htmlText="{str}"
                condenseWhite="true"
                width="100%"
                height="100%"
                change="textArea_change(event);"
                resize="textArea_change(event);" /&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_getTextField_numLines_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/TextArea_getTextField_numLines_test/bin/main.html" width="100%" height="350"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining the number of lines in a TextArea control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/',contentID: 'post-617',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getTextField(),mx internal,numLines',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/05/08/determining-the-number-of-lines-in-a-textarea-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Adding links to a Panel container&#8217;s status text in Flex</title>
		<link>http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 02:13:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Panel]]></category>
		<category><![CDATA[TextEvent]]></category>
		<category><![CDATA[getStatusTextField()]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[selectable]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can assign an HTML formatted string to a Panel container&#8217;s status text field using the getStatusTextField() method in the mx_internal namespace.</p> <p></p> <p class="alert">Since this example uses the mx_internal namespace, you can&#8217;t always depend on this behavior to work in future versions of the Flex SDK. Use at your [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can assign an HTML formatted string to a Panel container&#8217;s status text field using the <code>getStatusTextField()</code> method in the <code>mx_internal</code> namespace.</p>
<p><span id="more-598"></span></p>
<p class="alert">Since this example uses the <strong>mx_internal</strong> namespace, you can&#8217;t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Panel_getStatusTextField_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.core.IUITextField;</span>
<span style="color: #339933;">            import mx.controls.Alert;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                var tf:IUITextField = panel.mx_internal::getStatusTextField();</span>
<span style="color: #339933;">                tf.selectable = true;</span>
<span style="color: #339933;">                tf.addEventListener(TextEvent.LINK, textField_link);</span>
<span style="color: #339933;">                tf.htmlText = &quot;status with &lt;a href='event:showAlert'&gt;&lt;u&gt;link&lt;/u&gt;&lt;/a&gt;&quot;;</span>
&nbsp;
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function textField_link(evt:TextEvent):void {</span>
<span style="color: #339933;">                Alert.show(&quot;Success! A Panel container with a link in the status text.&quot;, evt.text);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Panel</span> id=<span style="color: #ff0000;">&quot;panel&quot;</span></span>
<span style="color: #000000;">            title=<span style="color: #ff0000;">&quot;Title&quot;</span></span>
<span style="color: #000000;">            status=<span style="color: #ff0000;">&quot;status with link&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;240&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> text=<span style="color: #ff0000;">&quot;Click the link in the Panel container's status bar to launch an Alert control.&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span> selectable=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> htmlText=<span style="color: #ff0000;">&quot;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; The status text field must have it's selectable property set to true in order to dispatch the link event.&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;100%&quot;</span> selectable=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Panel</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Panel_getStatusTextField_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/Panel_getStatusTextField_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="note">The status text field must have it&#8217;s <code>selectable</code> property set to <code>true</code> in order to dispatch the <code>link</code> event.</p>
<p class="construction">Note that the Panel container&#8217;s status message was initially set to the desired final string, minus any HTML formatting. This ensures that when the status text is created and measured, the HTML formatted text <i>should</i> fit correctly when it is substituted. This may not work if the width of your text changes due to bold fonts or other changes.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Adding links to a Panel container\&#039;s status text in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/',contentID: 'post-598',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getStatusTextField(),link,mx internal,selectable',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/04/17/adding-links-to-a-panel-containers-status-text-in-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Accessing a TitleWindow container&#8217;s internal close button in Flex</title>
		<link>http://blog.flexexamples.com/2008/03/24/accessing-a-titlewindow-containers-internal-close-button-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/03/24/accessing-a-titlewindow-containers-internal-close-button-in-flex/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 06:55:43 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TitleWindow]]></category>
		<category><![CDATA[closeButton]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[showCloseButton]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/03/24/accessing-a-titlewindow-containers-internal-close-button-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can access the close button in a Flex TitleWindow container by using the closeButton property in the mx_internal namespace.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">Since this example uses the mx_internal namespace, you can’t always depend on this behavior to work in future versions of the Flex SDK. [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can access the close button in a Flex TitleWindow container by using the <code>closeButton</code> property in the <code>mx_internal</code> namespace.</p>
<p>Full code after the jump.</p>
<p><span id="more-573"></span></p>
<p class="alert">Since this example uses the <code>mx_internal</code> namespace, you can’t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TitleWindow_closeButton_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/03/24/accessing-a-titlewindow-containers-internal-close-button-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[
            import mx.events.CloseEvent;
            import mx.controls.Button;

            private function checkBox_change(evt:Event):void {
                var btn:Button = titleWindow.mx_internal::closeButton;
                btn.enabled = checkBox.selected;
            }

            private function titleWindow_close(evt:CloseEvent):void {
                arrColl.addItem({type:evt.type, time:getTimer()});
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="arrColl" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="closeButton enabled:"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TitleWindow id="titleWindow"
            showCloseButton="true"
            width="100%"
            close="titleWindow_close(event);"&gt;
        &lt;mx:DataGrid id="dataGrid"
                dataProvider="{arrColl}"
                width="100%"
                rowCount="6"&gt;
            &lt;mx:columns&gt;
                &lt;mx:DataGridColumn dataField="type" /&gt;
                &lt;mx:DataGridColumn dataField="time" /&gt;
            &lt;/mx:columns&gt;
        &lt;/mx:DataGrid&gt;
    &lt;/mx:TitleWindow&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TitleWindow_closeButton_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/TitleWindow_closeButton_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Accessing a TitleWindow container\&#039;s internal close button in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/03/24/accessing-a-titlewindow-containers-internal-close-button-in-flex/',contentID: 'post-573',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'closeButton,mx internal,showCloseButton',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/03/24/accessing-a-titlewindow-containers-internal-close-button-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Clearing the video on a Flex VideoDisplay control</title>
		<link>http://blog.flexexamples.com/2008/01/15/clearing-the-video-on-a-flex-videodisplay-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/15/clearing-the-video-on-a-flex-videodisplay-control/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 16:39:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VideoDisplay]]></category>
		<category><![CDATA[clear()]]></category>
		<category><![CDATA[mx internal]]></category>
		<category><![CDATA[videoPlayer]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/15/clearing-the-video-on-a-flex-videodisplay-control/</guid>
		<description><![CDATA[<p>I posted this in response to a forum question the other day and thought I&#8217;d share the code here.</p> <p>The following example shows you how you can clear a VideoDisplay control&#8217;s content using the videoPlayer property in the mx_internal namespace.</p> <p>Full code after the jump.</p> <p></p> <p>Option 1: Call the videoDisplay.mx_internal::videoPlayer.clear() method directly from our [...]]]></description>
			<content:encoded><![CDATA[<p>I posted this in response to a forum question the other day and thought I&#8217;d share the code here.</p>
<p>The following example shows you how you can clear a VideoDisplay control&#8217;s content using the <code>videoPlayer</code> property in the <code>mx_internal</code> namespace.</p>
<p>Full code after the jump.</p>
<p><span id="more-450"></span></p>
<p><strong>Option 1:</strong> Call the <code>videoDisplay.mx_internal::videoPlayer.clear()</code> method directly from our MXML file:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_test/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/15/clearing-the-video-on-a-flex-videodisplay-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"&gt;

    &lt;mx:VideoDisplay id="videoDisplay"
            source="http://www.helpexamples.com/flash/video/cuepoints.flv" /&gt;

    &lt;mx:Button label="pause"
            click="videoDisplay.pause();" /&gt;
    &lt;mx:Button label="clear"
            click="videoDisplay.mx_internal::videoPlayer.clear();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_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/VideoDisplay_videoPlayer_clear_test/bin/main.html" width="100%" height="350"></iframe></p>
<p><strong>Option 2:</strong> Extend the VideoDisplay class in ActionScript, and add a custom <code>clear()</code> method which calls the <code>mx_internal::videoPlayer.clear()</code> method:</p>
<pre class="code">
package {
    import mx.controls.VideoDisplay;
    import mx.core.mx_internal;

    public class MyVideoDisplay extends VideoDisplay {
        public function MyVideoDisplay() {
            super();
        }

        public function clear():void {
            pause();
            mx_internal::videoPlayer.clear();
        }
    }
}
</pre>
<p>Then, in our MXML file, we simply add our MyVideoDisplay custom component and call our <code>clear()</code> method directly:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_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/15/clearing-the-video-on-a-flex-videodisplay-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:custom="*"
        layout="vertical"&gt;

    &lt;custom:MyVideoDisplay id="myVideoDisplay"
            source="http://www.helpexamples.com/flash/video/cuepoints.flv" /&gt;

    &lt;mx:Button label="clear"
        click="myVideoDisplay.clear();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_test_2/bin/srcview/index.html">View source</a></p>
<p><strong>Option 3:</strong> Create a custom component in MXML that extends the VideoDisplay control. Again, we add our own custom <code>clear()</code> method which calls the <code>mx_internal::videoPlayer.clear()</code> method:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_test_3/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/15/clearing-the-video-on-a-flex-videodisplay-control/ --&gt;
&lt;mx:VideoDisplay xmlns:mx="http://www.adobe.com/2006/mxml"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.core.mx_internal;

            public function clear():void {
                pause();
                mx_internal::videoPlayer.clear();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:VideoDisplay&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_videoPlayer_clear_test_3/bin/srcview/index.html">View source</a></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Clearing the video on a Flex VideoDisplay control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/15/clearing-the-video-on-a-flex-videodisplay-control/',contentID: 'post-450',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'clear(),mx internal,videoPlayer',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/15/clearing-the-video-on-a-flex-videodisplay-control/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Creating an Alert control with non-selectable text</title>
		<link>http://blog.flexexamples.com/2007/08/10/creating-an-alert-control-with-non-selectable-text/</link>
		<comments>http://blog.flexexamples.com/2007/08/10/creating-an-alert-control-with-non-selectable-text/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 00:10:07 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Alert]]></category>
		<category><![CDATA[mx internal]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/10/creating-an-alert-control-with-non-selectable-text/</guid>
		<description><![CDATA[<p>Ever wonder how you could create an Alert control but make the text be non-selectable (without subclassing the Alert control, that is)? Well, here&#8217;s how.</p> <p>By using the hidden powers of the &#8220;mx_internal&#8221; namespace, you can access the Alert control&#8217;s internal alertForm property (an AlertForm object &#8212; for more information see the AlertForm.as class in [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wonder how you could create an Alert control but make the text be non-selectable (without subclassing the Alert control, that is)? Well, here&#8217;s how.</p>
<p>By using the hidden powers of the &#8220;mx_internal&#8221; namespace, you can access the Alert control&#8217;s internal <code>alertForm</code> property (an AlertForm object &#8212; for more information see the AlertForm.as class in the mx.controls.alertClasses package) and from there modify the internal <code>textField</code> property (a UITextField object), and set the <code>selectable</code> property to false.</p>
<p>Taa-daa! Non-selectable text.</p>
<p>Full code after the jump.</p>
<p><span id="more-80"></span></p>
<p class="alert">Since this example uses the mx_internal namespace, you can’t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_alertForm_textField_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/08/10/creating-an-alert-control-with-non-selectable-text/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init()"&gt;

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

            private var a:Alert;

            private function init():void {
                Alert.buttonWidth = 100;
                Alert.okLabel = "You rule!";
                Alert.cancelLabel = "I hate you!";
                a = Alert.show("This is some text, but you cant select it.", "An Alert control with unselectable text", Alert.OK | Alert.CANCEL);
                a.mx_internal::alertForm.mx_internal::textField.selectable = false;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Button label="Launch Alert" click="init()" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_alertForm_textField_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/Alert_alertForm_textField_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating an Alert control with non-selectable text on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/10/creating-an-alert-control-with-non-selectable-text/',contentID: 'post-80',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'mx internal',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/08/10/creating-an-alert-control-with-non-selectable-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting an icon in an Alert control</title>
		<link>http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/</link>
		<comments>http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/#comments</comments>
		<pubDate>Sun, 22 Jul 2007 05:04:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Alert]]></category>
		<category><![CDATA[Embed]]></category>
		<category><![CDATA[alertForm]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[mx internal]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/</guid>
		<description><![CDATA[<p>Similar to the previous post where we covered a couple of techniques for embedding an icon into a Button control, this post explores embedding an icon into an Alert control. An icon in an Alert control appears to the left of the alert&#8217;s message text, but the second example will show how you can easily [...]]]></description>
			<content:encoded><![CDATA[<p>Similar to the previous post where we covered a couple of techniques for embedding an icon into a Button control, this post explores embedding an icon into an Alert control. An icon in an Alert control appears to the left of the alert&#8217;s message text, but the second example will show how you can easily tweak the code to also add icons to the nested buttons controls within the alert dialog itself. See the full code after the jump.</p>
<p><span id="more-14"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test/bin/srcview/Alert_icon_test.zip">Download source (ZIP, 2K)</a> | <a href="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test/main.mxml" target="_mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        creationComplete="showAlert();"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            // Embed the error.png image.
            [Bindable]
            [Embed(source='assets/error.png')]
            private var Icon:Class;

            private var a:Alert;

            private function showAlert():void {
                var titleText:String = "WARNING";
                var messageText:String = "Are you sure you would like to erase the Internet?\\n\\nPress OK to continue, or Cancel to abort.";
                /* Display the Alert, show the OK and Cancel buttons,
                    and show an icon represented by the Icon binding. */
                a = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
            }

            private function doClose(evt:CloseEvent):void {
                // do nothing.
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Button label="Launch Alert" click="showAlert();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information">View source enabled in the following example.</p>
<p><iframe height="200" width="100%" src="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test/bin/main.html"></iframe></p>
<p>The second example uses the mx_internal namespace to access a couple of internal properties (descriptions taken from the documented source code):</p>
<blockquote><p><code>alertForm</code> &#8212; The internal AlertForm object that contains the text, icon, and buttons of the Alert control.<br />
<code>buttons</code> &#8212; An Array that contains any Buttons appearing in the Alert control.</p></blockquote>
<p class="alert">Since this example uses the <strong>mx_internal</strong> namespace, you can&#8217;t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test_2/bin/srcview/Alert_icon_test_2.zip">Download source (ZIP, 4K)</a> | <a href="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test_2/main.mxml" target="_mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        creationComplete="showAlert();"
        backgroundColor="white" &gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            [Bindable]
            [Embed(source='assets/error.png')]
            private var Icon:Class;

            [Bindable]
            [Embed(source='assets/tick.png')]
            private var TickIcon:Class;

            [Bindable]
            [Embed(source='assets/cross.png')]
            private var CrossIcon:Class;

            private var a:Alert;

            private function showAlert():void {
                /* Set button width so it is large enough to accomodate
                    an icon and default button labels. */
                Alert.buttonWidth = 100;

                var titleText:String = "WARNING";
                var messageText:String = "Are you sure you would like to erase the Internet?\\n\\nPress OK to continue, or Cancel to abort.";
                /* Display the Alert, show the OK and Cancel buttons,
                    and show an icon represented by the Icon binding. */
                a = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);

                /* Get a reference to the Alert control's internal
                    buttons array. */
                var buttonArray:Array = a.mx_internal::alertForm.mx_internal::buttons;

                /* Set the first button to the TickIcon class, and the
                    second icon to the CrossIcon class. */
                buttonArray[0].setStyle("icon", TickIcon);
                buttonArray[1].setStyle("icon", CrossIcon);

                progressBar.visible = false;
            }

            private function doClose(evt:CloseEvent):void {
                if (evt.detail == Alert.OK) {
                    progressBar.visible = true;
                } else if (evt.detail == Alert.CANCEL) {
                    // do nothing.
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Button label="Launch Alert"
            click="showAlert();" /&gt;

    &lt;mx:ProgressBar id="progressBar"
            label="Deleting..."
            indeterminate="true"
            visible="false" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information">View source enabled in the following example.</p>
<p><iframe height="200" width="100%" src="http://blog.flexexamples.com/wp-content/uploads/Alert_icon_test_2/bin/main.html"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting an icon in an Alert control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/',contentID: 'post-14',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'alertForm,icon,mx internal',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/07/21/setting-an-icon-in-an-alert-control/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

