<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Preventing line feeds in a TextArea control in Flex</title>
	<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Sat, 06 Sep 2008 17:16:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14802</link>
		<author>peterd</author>
		<pubDate>Wed, 20 Aug 2008 03:57:51 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14802</guid>
		<description>manovotny,

The code is a bit rough, but does the following work for you?
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            private function textArea_textInput(evt:TextEvent):void {
                if (evt.text == "\\n") {
                    evt.preventDefault();
                }
            }
            private function textArea_change(evt:Event):void {
                textArea.text = textArea.text.replace(/\\n&#124;\\r/ig, "");
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:TextArea id="textArea"
            text="The quick brown fox jumped over the lazy dog."
            verticalScrollPolicy="on"
            width="100%"
            height="100%"
            textInput="textArea_textInput(event);"
            change="textArea_change(event);" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>manovotny,</p>
<p>The code is a bit rough, but does the following work for you?</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function textArea_textInput(evt:TextEvent):void {
                if (evt.text == "\n") {
                    evt.preventDefault();
                }
            }
            private function textArea_change(evt:Event):void {
                textArea.text = textArea.text.replace(/\n|\r/ig, "");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:TextArea id="textArea"
            text="The quick brown fox jumped over the lazy dog."
            verticalScrollPolicy="on"
            width="100%"
            height="100%"
            textInput="textArea_textInput(event);"
            change="textArea_change(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manovotny</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14798</link>
		<author>manovotny</author>
		<pubDate>Tue, 19 Aug 2008 19:59:55 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14798</guid>
		<description>PEFRECT!  This solves half of my problem...  Care to share if you have a way to prevent someone from doing a copy/paste of text with line feeds in it?  Solve that and I'll be home free!</description>
		<content:encoded><![CDATA[<p>PEFRECT!  This solves half of my problem&#8230;  Care to share if you have a way to prevent someone from doing a copy/paste of text with line feeds in it?  Solve that and I&#8217;ll be home free!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: çin, cin</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14390</link>
		<author>çin, cin</author>
		<pubDate>Tue, 29 Jul 2008 16:27:40 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-14390</guid>
		<description>Can arrow keys disable?  I do not know how to do this.</description>
		<content:encoded><![CDATA[<p>Can arrow keys disable?  I do not know how to do this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learning Everthing</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-12280</link>
		<author>Learning Everthing</author>
		<pubDate>Fri, 25 Apr 2008 06:55:03 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-12280</guid>
		<description>How can I disable backspace, left arrow and right arrow keys ?</description>
		<content:encoded><![CDATA[<p>How can I disable backspace, left arrow and right arrow keys ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manish sankhe</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-7743</link>
		<author>manish sankhe</author>
		<pubDate>Fri, 21 Mar 2008 06:12:58 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-7743</guid>
		<description>hi dis is manish workin in teknopoint multimedia thanks for givin the source of this code...i was trying to disable the enter key by using ifocus manager bt everythin invain..ur code help me out in dis thanks....</description>
		<content:encoded><![CDATA[<p>hi dis is manish workin in teknopoint multimedia thanks for givin the source of this code&#8230;i was trying to disable the enter key by using ifocus manager bt everythin invain..ur code help me out in dis thanks&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jexchan</title>
		<link>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-7404</link>
		<author>jexchan</author>
		<pubDate>Sat, 08 Mar 2008 06:42:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/#comment-7404</guid>
		<description>Hi,Peter deHaan

Thanks for your great post!

I have a another question about this.

I use TextArea component in flex, trigger "Ctrl + Enter" event to newline(use this to send messege in my project), but more empty newline in IE(it's ok in Firefox or trigger 'Shift+Enter'),how can i solve this problem?

Thank you very much!!!

Code like below

if(evt.ctrlKey == true &#38;&#38; evt.keyCode == Keyboard.ENTER) {
  ......
}</description>
		<content:encoded><![CDATA[<p>Hi,Peter deHaan</p>
<p>Thanks for your great post!</p>
<p>I have a another question about this.</p>
<p>I use TextArea component in flex, trigger &#8220;Ctrl + Enter&#8221; event to newline(use this to send messege in my project), but more empty newline in IE(it&#8217;s ok in Firefox or trigger &#8216;Shift+Enter&#8217;),how can i solve this problem?</p>
<p>Thank you very much!!!</p>
<p>Code like below</p>
<p>if(evt.ctrlKey == true &amp;&amp; evt.keyCode == Keyboard.ENTER) {<br />
  &#8230;&#8230;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
