<?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>ADM Blog &#187; points</title>
	<atom:link href="http://blog.another-d-mention.ro/tag/points/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.another-d-mention.ro</link>
	<description>No matter how you see things, reality changes when you reach understanding</description>
	<lastBuildDate>Tue, 29 Jun 2010 06:12:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Adding ellipsis points in a TextArea component in Flex</title>
		<link>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/</link>
		<comments>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 14:55:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex / ActionScript]]></category>
		<category><![CDATA[ellipsis]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[points]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://blog.another-d-mention.ro/?p=779</guid>
		<description><![CDATA[The goal here is to use a TextArea component to display some text that doesn't quite fit in the specified region and ellipsis points (...) should be showed to let user know the text is trimmed. Standard stuff right ? But Flex doesn't do it by itself and I thought someone might look for this. [...]


Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/extendedimage-component/' rel='bookmark' title='Permanent Link: ExtendedImage Component'>ExtendedImage Component</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/right-click-and-custom-context-menu-in-flash-flex/' rel='bookmark' title='Permanent Link: Right click and custom context menu in Flash/Flex'>Right click and custom context menu in Flash/Flex</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The goal here is to use a TextArea component to display some text that doesn't quite fit in the specified region and ellipsis points (...) should be showed to let user know the text is trimmed. Standard stuff right ? But Flex doesn't do it by itself and I thought someone might look for this.</p>
<p>My problem was with a Flex app that uses i18n and in some languages the text didn't fit the box, the scroll bar policy was off and user had no idea there was more text in there and didn't had the possibility to scroll further. Anyway, here it is :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">&lt;</span>mx <span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">text</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000000; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000000; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000000; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000000; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span>;
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> trim<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">String</span> 
			<span style="color: #000000;">&#123;</span>
				box.<span style="color: #004993;">text</span> = <span style="color: #004993;">text</span>;
				box.validateNow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>box.maxVerticalScrollPosition <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">text</span> = <span style="color: #004993;">text</span>.<span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;...&quot;</span>, <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">text</span> = <span style="color: #004993;">text</span>.<span style="color: #004993;">substr</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #004993;">text</span>.<span style="color: #004993;">length</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;...&quot;</span>;
				<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">text</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> trim<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span>;	
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx <span style="color: #000000; font-weight: bold;">:</span>TextArea id=<span style="color: #990000;">&quot;box&quot;</span>
		verticalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span>
		<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;250&quot;</span>
		<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50&quot;</span>
		<span style="color: #004993;">wordWrap</span>=<span style="color: #990000;">&quot;true&quot;</span>	
		<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{trim(this.text)}&quot;</span>
		paddingBottom=<span style="color: #990000;">&quot;0&quot;</span>	
		editable=<span style="color: #990000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></pre></td></tr></table></div>

<p><img src="http://blog.another-d-mention.ro/wp-content/uploads/2010/01/untitled.PNG" alt="Flex Output" title="Flex Output" width="278" height="74" class="aligncenter size-full wp-image-784" /></p>


<p>Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/extendedimage-component/' rel='bookmark' title='Permanent Link: ExtendedImage Component'>ExtendedImage Component</a></li>
<li><a href='http://blog.another-d-mention.ro/programming/right-click-and-custom-context-menu-in-flash-flex/' rel='bookmark' title='Permanent Link: Right click and custom context menu in Flash/Flex'>Right click and custom context menu in Flash/Flex</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
