<?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; appendText()</title>
	<atom:link href="http://blog.flexexamples.com/tag/appendtext/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>Inserting and appending text into a Spark TextArea control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/08/04/inserting-and-appending-text-into-a-spark-textarea-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/08/04/inserting-and-appending-text-into-a-spark-textarea-control-in-flex-4/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 16:20:57 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[appendText()]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[insertText()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1323</guid>
		<description><![CDATA[<p>The following example shows how you can insert and append text into a Spark TextArea control in Flex 4 by using the insertText() and appendText() methods.</p> <p> appendText() &#8212; Appends the specified text to the end of the RichEditableText, as if you had clicked at the end and typed it. When RichEditableText supports vertical scrolling, [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can insert and append text into a Spark TextArea control in Flex 4 by using the <code>insertText()</code> and <code>appendText()</code> methods.</p>
<blockquote><p>
<code>appendText()</code> &#8212; Appends the specified text to the end of the RichEditableText, as if you had clicked at the end and typed it. When RichEditableText supports vertical scrolling, it will scroll to ensure that the last line of the inserted text is visible.<br />
<code>insertText()</code> &#8212; Inserts the specified text as if you had typed it. If a range was selected, the new text replaces the selected text; if there was an insertion point, the new text is inserted there, otherwise the text is appended to the text that is there. An insertion point is then set after the new text.
</p></blockquote>
<p>Full code after the jump.</p>
<p><span id="more-1323"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></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/2009/08/04/inserting-and-appending-text-into-a-spark-textarea-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_TextArea_insertText_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            protected var counter:uint = <span style="color: #cc66cc;">0</span>;</span>
&nbsp;
<span style="color: #000000;">            protected function insertBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                txtArea.insertText<span style="color: #66cc66;">&#40;</span>counter + <span style="color: #ff0000;">&quot;) &quot;</span> + txtInput.text + <span style="color: #ff0000;">&quot;\n&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                counter++;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function appendBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                txtArea.appendText<span style="color: #66cc66;">&#40;</span>counter + <span style="color: #ff0000;">&quot;) &quot;</span> + txtInput.text + <span style="color: #ff0000;">&quot;\n&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                counter++;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> cornerRadius=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;txtInput&quot;</span></span>
<span style="color: #000000;">                text=<span style="color: #ff0000;">&quot;Enter text here&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;insertBtn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;insertText()&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;insertBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;appendBtn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;appendText()&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;appendBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;txtArea&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_insertText_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_insertText_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Inserting and appending text into a Spark TextArea control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/08/04/inserting-and-appending-text-into-a-spark-textarea-control-in-flex-4/',contentID: 'post-1323',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'appendText(),Gumbo,insertText()',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/08/04/inserting-and-appending-text-into-a-spark-textarea-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Auto-scrolling a Spark TextArea control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/08/03/auto-scrolling-a-spark-textarea-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/08/03/auto-scrolling-a-spark-textarea-control-in-flex-4/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 13:44:38 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[appendText()]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1319</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/11/27/auto-scrolling-a-textarea-control-in-flex/">&#8220;Auto-scrolling a TextArea control in Flex&#8221;</a>, we saw how you could auto-scroll a Flex Halo TextArea control when new content is added by setting the verticalScrollPosition property to the value of the maxVerticalScrollPosition property.</p> <p>The following example shows how you can auto-scroll a Flex 4 Spark TextArea control using the [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/11/27/auto-scrolling-a-textarea-control-in-flex/">&#8220;Auto-scrolling a TextArea control in Flex&#8221;</a>, we saw how you could auto-scroll a Flex Halo TextArea control when new content is added by setting the <code>verticalScrollPosition</code> property to the value of the <code>maxVerticalScrollPosition</code> property.</p>
<p>The following example shows how you can auto-scroll a Flex 4 Spark TextArea control using the <code>appendText()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-1319"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></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/2009/08/03/auto-scrolling-a-spark-textarea-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_TextArea_appendText_test&quot;</span></span>
<span style="color: #000000;">               xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">               xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">               xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&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: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            private var timer:Timer;</span>
&nbsp;
<span style="color: #000000;">            private function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                timer = new Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                timer.addEventListener<span style="color: #66cc66;">&#40;</span>TimerEvent.TIMER, onTimer<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                timer.start<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            private function onTimer<span style="color: #66cc66;">&#40;</span>evt:TimerEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var now:String = new Date<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.toTimeString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                var str:String = <span style="color: #ff0000;">&quot;[&quot;</span> + timer.currentCount + <span style="color: #ff0000;">&quot;] &quot;</span> + now;</span>
<span style="color: #000000;">                textArea.appendText<span style="color: #66cc66;">&#40;</span>str + <span style="color: #ff0000;">&quot;\n&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;textArea&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;on&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_appendText_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_appendText_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Auto-scrolling a Spark TextArea control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/08/03/auto-scrolling-a-spark-textarea-control-in-flex-4/',contentID: 'post-1319',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'appendText(),Gumbo',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/08/03/auto-scrolling-a-spark-textarea-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

