<?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; selectable</title>
	<atom:link href="http://blog.flexexamples.com/tag/selectable/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>Toggling whether a user can select text in a TextArea control in Flex</title>
		<link>http://blog.flexexamples.com/2008/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 05:02:26 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[TextArea]]></category>
		<category><![CDATA[selectable]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/</guid>
		<description><![CDATA[<p>The following examples show how you can control whether a user can select the text in a Flex TextArea control by setting the selectable property in MXML and ActionScript.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_selectable_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/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/ --&#62; &#60;mx:Application name="TextArea_selectable_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following examples show how you can control whether a user can select the text in a Flex TextArea control by setting the <code>selectable</code> property in MXML and ActionScript.</p>
<p>Full code after the jump.</p>
<p><span id="more-733"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_selectable_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/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/ --&gt;
&lt;mx:Application name="TextArea_selectable_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="selectable:"&gt;
                &lt;mx:CheckBox id="checkBox"
                        selected="true" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TextArea id="textArea"
            selectable="{checkBox.selected}"
            text="The quick brown fox jumped over the lazy dog." /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_selectable_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_selectable_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>selectable</code> property using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/TextArea_selectable_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/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/ --&gt;
&lt;mx:Application name="TextArea_selectable_test"
        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 {
                textArea.selectable = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="selectable:"&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:TextArea id="textArea"
            text="The quick brown fox jumped over the lazy dog." /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling whether a user can select text in a TextArea control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/',contentID: 'post-733',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '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/08/06/toggling-whether-a-user-can-select-text-in-a-textarea-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Preventing users from changing the ComboBox control in Flex</title>
		<link>http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 06:23:24 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ComboBox]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[selectable]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can prevent users from changing the value in a Flex ComboBox control by setting the dropdown menu&#8217;s selectable property.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.DropdownEvent; private function comboBox_open(evt:DropdownEvent):void { comboBox.dropdown.selectable = checkBox.selected; } ]]&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can prevent users from changing the value in a Flex ComboBox control by setting the dropdown menu&#8217;s <code>selectable</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-701"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.DropdownEvent;

            private function comboBox_open(evt:DropdownEvent):void {
                comboBox.dropdown.selectable = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="One" /&gt;
        &lt;mx:Object label="Two" /&gt;
        &lt;mx:Object label="Three" /&gt;
        &lt;mx:Object label="Four" /&gt;
        &lt;mx:Object label="Five" /&gt;
        &lt;mx:Object label="Six" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="selectable:"
                labelPlacement="left"
                selected="false" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ComboBox id="comboBox"
            prompt="Please select an item"
            dataProvider="[One,Two,Three,Four,Five,Six]"
            open="comboBox_open(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Preventing users from changing the ComboBox control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/07/10/preventing-users-from-changing-the-combobox-control-in-flex/',contentID: 'post-701',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dropdown,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/07/10/preventing-users-from-changing-the-combobox-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</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>Preventing a user from selecting an item in a Flex DataGrid control</title>
		<link>http://blog.flexexamples.com/2008/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/</link>
		<comments>http://blog.flexexamples.com/2008/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 05:50:42 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[itemClick]]></category>
		<category><![CDATA[selectable]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/</guid>
		<description><![CDATA[<p>The following example shows how you can prevent a user from selecting items in a Flex DataGrid control by setting the selectable property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGrid_selectable_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/ --&#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.events.ListEvent; import mx.controls.Alert; private function dataGrid_itemClick(evt:ListEvent):void { Alert.show(evt.itemRenderer.data.label, [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can prevent a user from selecting items in a Flex DataGrid control by setting the <code>selectable</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-506"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGrid_selectable_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/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/ --&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.ListEvent;
            import mx.controls.Alert;

            private function dataGrid_itemClick(evt:ListEvent):void {
                Alert.show(evt.itemRenderer.data.label, evt.type);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Alert" /&gt;
        &lt;mx:Object label="Button" /&gt;
        &lt;mx:Object label="ButtonBar" /&gt;
        &lt;mx:Object label="CheckBox" /&gt;
        &lt;mx:Object label="ColorPicker" /&gt;
        &lt;mx:Object label="ComboBox" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="selectable:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arr}"
            selectable="{checkBox.selected}"
            rowCount="4"
            width="200"
            change="dataGrid_itemClick(event);"
            itemClick="dataGrid_itemClick(event);"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGrid_selectable_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/DataGrid_selectable_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>As you can see, if you click an item in a DataGrid control when the <code>selectable</code> property is <code>false</code>, only the <code>itemClick</code> event is dispatched, but if the <code>selectable</code> property is <code>true</code>, both the <code>change</code> and <code>itemClick</code> events are dispatched.</p>
<p class="new">If you just want to disable the roll over highlighting, see <a href="http://blog.flexexamples.com/2008/02/01/disabling-item-roll-over-highlighting-in-the-flex-datagrid-control/">&#8220;Disabling item roll over highlighting in the Flex DataGrid control&#8221;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Preventing a user from selecting an item in a Flex DataGrid control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/',contentID: 'post-506',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'itemClick,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/02/01/preventing-a-user-from-selecting-an-item-in-a-flex-datagrid-control/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Listening for the link event in a Flex Label control</title>
		<link>http://blog.flexexamples.com/2008/01/26/listening-for-the-link-event-in-a-flex-label-control/</link>
		<comments>http://blog.flexexamples.com/2008/01/26/listening-for-the-link-event-in-a-flex-label-control/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 08:49:21 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Label]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[selectable]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/26/listening-for-the-link-event-in-a-flex-label-control/</guid>
		<description><![CDATA[<p>The following example shows how you can use the link event with the Label control in Flex to handle hyperlinks embedded within a string of text. By using the &#8220;event:&#8221; prefix in the href property of an anchor (&#60;a /&#62;) tag, you can handle links within your Flex application, use the ExternalInterface API to call [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use the <code>link</code> event with the Label control in Flex to handle hyperlinks embedded within a string of text. By using the &#8220;event:&#8221; prefix in the <code>href</code> property of an anchor (&lt;a /&gt;) tag, you can handle links within your Flex application, use the ExternalInterface API to call JavaScript from Flex, or do pretty much whatever else you want.</p>
<p>Full code after the jump.</p>
<p><span id="more-481"></span></p>
<p class="alert">The Label control must have the <code>selectable</code> property set to <code>true</code> to generate the <code>link</code> event.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_link_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/26/listening-for-the-link-event-in-a-flex-label-control/ --&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;

            private function lbl_initialize():void {
                lbl.htmlText = "For more information on Flex, see &lt;u&gt;&lt;a href='event:flex.org'&gt;http://www.flex.org/&lt;/a&gt;&lt;/u&gt;.";            }

            private function lbl_link(evt:TextEvent):void {
                Alert.show(evt.toString(), evt.text);

                switch (evt.text) {
                    case "flex.org":
                        // You clicked the flex.org link.
                        break;
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Label id="lbl"
            selectable="true"
            initialize="lbl_initialize();"
            link="lbl_link(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Label_link_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/Label_link_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>Another useful little tip when dealing with HTML text, is to put your HTML into an external file, and then embed it into your application using &lt;mx:String /&gt;, as seen in the following snippet:</p>
<pre class="code">
<strong style="color:red;">&lt;mx:String id=&quot;str&quot; source=&quot;text.html&quot; /&gt;</strong>

&lt;mx:Label id=&quot;lbl&quot;
        <strong style="color:red;">htmlText=&quot;{str}&quot;</strong>
        selectable=&quot;true&quot;
        link=&quot;lbl_link(event);&quot; /&gt;
</pre>
<p>And then your text.html file would look like the following:</p>
<pre class="code">
&lt;p&gt;For more information on Flex, see &lt;u&gt;&lt;a href="event:flex.org"&gt;http://www.flex.org/&lt;/a&gt;&lt;/u&gt;.&lt;/p&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Listening for the link event in a Flex Label control on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/26/listening-for-the-link-event-in-a-flex-label-control/',contentID: 'post-481',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'event,link,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/01/26/listening-for-the-link-event-in-a-flex-label-control/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

