<?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>Web Development London UK &#187; actionscript</title>
	<atom:link href="http://hsmoore.com/blog/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://hsmoore.com</link>
	<description>Web Development London UK</description>
	<lastBuildDate>Wed, 01 Feb 2012 12:10:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Super Easy Email Validation AS2</title>
		<link>http://hsmoore.com/blog/super-easy-email-validation-as2/</link>
		<comments>http://hsmoore.com/blog/super-easy-email-validation-as2/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 09:45:21 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[actionscript 2]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=963</guid>
		<description><![CDATA[I needed a quick and easy way to check for the basics of an email address. Does it contain &#8220;@&#8221; and &#8220;.&#8221; symbols. This is by no meals a foolproof method, so don&#8217;t use it for anything big, but if you want to just do a quick test then here you go: var email:String =...]]></description>
			<content:encoded><![CDATA[<p>I needed a quick and easy way to check for the basics of an email address.</p>
<p>Does it contain &#8220;@&#8221; and &#8220;.&#8221; symbols.</p>
<p>This is by no meals a foolproof method, so don&#8217;t use it for anything big, but if you want to just do a quick test then here you go:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> email:<span class="kw3">String</span> = <span class="st0">&quot;name@server.com&quot;</span>;</p>
<p><span class="kw1">if</span> <span class="br0">&#40;</span>email.<span class="kw3">indexOf</span><span class="br0">&#40;</span><span class="st0">&quot;@&quot;</span><span class="br0">&#41;</span><span class="sy0">!</span>=-1 <span class="sy0">&amp;&amp;</span> email.<span class="kw3">indexOf</span><span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span><span class="br0">&#41;</span><span class="sy0">!</span>=-1<span class="br0">&#41;</span> <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;false&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">else</span> <span class="kw3">trace</span> <span class="br0">&#40;</span><span class="st0">&quot;true&quot;</span><span class="br0">&#41;</span>;</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/super-easy-email-validation-as2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1180 Call to a possibly undefined method navigateToURL</title>
		<link>http://hsmoore.com/blog/1180-call-to-a-possibly-undefined-method-navigatetourl/</link>
		<comments>http://hsmoore.com/blog/1180-call-to-a-possibly-undefined-method-navigatetourl/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 09:50:58 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[navigateToURL]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=886</guid>
		<description><![CDATA[1180 Call to a possibly undefined method navigateToURL If you get the above error when trying to run your flash actionscript 3 file, you are obviously trying to use the navigateToURL() function but have not imported the flash.net library code. The following code before everything will correct the problem. import flash.net.*; ..or a more of...]]></description>
			<content:encoded><![CDATA[<p><em><strong><span style="color: #ff0000;">1180 Call to a possibly undefined method navigateToURL</span></strong></em></p>
<p>If you get the above error when trying to run your flash actionscript 3 file, you are obviously trying to use the navigateToURL() function but have not imported the flash.net library code.</p>
<p>The following code before everything will correct the problem.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="sy0">*</span>;</div>
</div>
<p>..or a more of a direct unbloated method is as follows:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="me1">navigateToURL</span>;</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/1180-call-to-a-possibly-undefined-method-navigatetourl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to use a Timer in Actionscript 3</title>
		<link>http://hsmoore.com/blog/how-to-use-a-timer-in-actionscript-3/</link>
		<comments>http://hsmoore.com/blog/how-to-use-a-timer-in-actionscript-3/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 09:16:47 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=878</guid>
		<description><![CDATA[It is really easy to create a Timer in Actionscript 3. Instantiate the Timer Class and pass a time in millions of 1000 to it to work in seconds. var myTimer:Timer = new Timer&#40;1000&#41;; Setup an event listener to call a function. myTimer.addEventListener&#40;&#34;timer&#34;, myTimerEventHandler&#41;; Start the Timer. myTimer.start&#40;&#41;; Start the Timer. function myTimerEventHandler&#40;event:TimerEvent&#41;:void &#123; &#160;...]]></description>
			<content:encoded><![CDATA[<p>It is really easy to create a Timer in Actionscript 3.</p>
<p>Instantiate the Timer Class and pass a time in millions of 1000 to it to work in seconds.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> myTimer:Timer = <span class="kw2">new</span> Timer<span class="br0">&#40;</span>1000<span class="br0">&#41;</span>;</div>
</div>
<p>Setup an event listener to call a function.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">myTimer.<span class="me1">addEventListener</span><span class="br0">&#40;</span><span class="st0">&quot;timer&quot;</span>, myTimerEventHandler<span class="br0">&#41;</span>;</div>
</div>
<p>Start the Timer.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">myTimer.<span class="kw3">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</div>
<p>Start the Timer.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">function</span> myTimerEventHandler<span class="br0">&#40;</span>event:TimerEvent<span class="br0">&#41;</span>:<span class="kw3">void</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span>myTimer.<span class="me1">currentCount</span>+<span class="st0">&quot; seconds have passed.&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>So altogether we have this.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> myTimer:Timer = <span class="kw2">new</span> Timer<span class="br0">&#40;</span>1000<span class="br0">&#41;</span>;<br />
myTimer.<span class="me1">addEventListener</span><span class="br0">&#40;</span><span class="st0">&quot;timer&quot;</span>, myTimerEventHandler<span class="br0">&#41;</span>;<br />
myTimer.<span class="kw3">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> myTimerEventHandler<span class="br0">&#40;</span>event:TimerEvent<span class="br0">&#41;</span>:<span class="kw3">void</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span>myTimer.<span class="me1">currentCount</span>+<span class="st0">&quot; seconds have passed.&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>Now you know how to use a Timer in Actionscript 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/how-to-use-a-timer-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 2 &amp; PHP Data Transfer</title>
		<link>http://hsmoore.com/blog/actionscript-2-php-data-transfer/</link>
		<comments>http://hsmoore.com/blog/actionscript-2-php-data-transfer/#comments</comments>
		<pubDate>Mon, 17 May 2010 11:09:32 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=824</guid>
		<description><![CDATA[In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it. It is a simple way of transferring data between the server and client. Actionscript 2 Code: callRemoteFile = function&#40;ourVariable:String&#41; &#123; &#160; &#160; &#160; &#160; var result_lv:LoadVars = new LoadVars&#40;&#41;; &#160; &#160; result_lv.onLoad = function&#40;success:Boolean&#41;...]]></description>
			<content:encoded><![CDATA[<p>In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it.<br />
It is a simple way of transferring data between the server and client.</p>
<h3>Actionscript 2 Code:</h3>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">callRemoteFile = <span class="kw2">function</span><span class="br0">&#40;</span>ourVariable:<span class="kw3">String</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> result_lv:<span class="kw3">LoadVars</span> = <span class="kw2">new</span> <span class="kw3">LoadVars</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; result_lv.<span class="kw3">onLoad</span> = <span class="kw2">function</span><span class="br0">&#40;</span>success:<span class="kw3">Boolean</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>success<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>result_lv.<span class="kw3">message</span>==<span class="st0">&quot;success&quot;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;done! &quot;</span>+result_lv.<span class="me1">returnValue</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span>result_lv.<span class="kw3">message</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;Error connecting to server&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> send_lv:<span class="kw3">LoadVars</span> = <span class="kw2">new</span> <span class="kw3">LoadVars</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; send_lv.<span class="me1">ourVariable</span> = ourVariable;<br />
&nbsp; &nbsp; send_lv.<span class="kw3">sendAndLoad</span><span class="br0">&#40;</span><span class="st0">&quot;http://www.andrewodendaal.com/example/file.php&quot;</span>, result_lv, <span class="st0">&quot;POST&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
callRemoteFile<span class="br0">&#40;</span><span class="st0">&quot;some text here&quot;</span><span class="br0">&#41;</span>;</div>
</div>
<h3>PHP Code:</h3>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">echo</span> <span class="st0">&quot;a=1&amp;message=success&amp;returnValue=&quot;</span><span class="sy0">.</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">&quot;ourVariable&quot;</span><span class="br0">&#93;</span><span class="sy0">.</span><span class="st0">&quot;&amp;b=2&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="kw1">echo</span> <span class="st0">&quot;a=0&amp;message=failed&amp;returnValue=nothing&amp;b=1&quot;</span><span class="sy0">;</span><br />
<span class="sy1">?&gt;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/actionscript-2-php-data-transfer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript2: Split string by line length with &amp; without word-wrap</title>
		<link>http://hsmoore.com/blog/split-string-by-line-length-with-and-without-word-wrap-using-actionscript-2/</link>
		<comments>http://hsmoore.com/blog/split-string-by-line-length-with-and-without-word-wrap-using-actionscript-2/#comments</comments>
		<pubDate>Wed, 05 May 2010 10:04:25 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Article]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[wordwrap]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=778</guid>
		<description><![CDATA[Split string into sentences by max line length. This uses a character array but doesn&#8217;t use word-wrapping. var personalMessage:String = &#34;You got this far so we reckon that you could be curious enough to learn a little more, we’ll contact you shortly to answer any questions you may have.&#34;; _root.myArray = new Array&#40;&#41;; _root.myArray =...]]></description>
			<content:encoded><![CDATA[<p>Split string into sentences by max line length.<br />
This uses a character array but doesn&#8217;t use word-wrapping.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> personalMessage:<span class="kw3">String</span> = <span class="st0">&quot;You got this far so we reckon that you could be curious enough to learn a little more, we’ll contact you shortly to answer any questions you may have.&quot;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">myArray</span> = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">myArray</span> = personalMessage.<span class="kw3">split</span><span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">mySentences</span> = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">var</span> currentCharCount:<span class="kw3">Number</span> = <span class="nu0">0</span>;<br />
<span class="kw2">var</span> currentCharItem:<span class="kw3">Number</span> = <span class="nu0">0</span>;<br />
<span class="kw2">var</span> currentCharString:<span class="kw3">String</span> = <span class="st0">&quot;&quot;</span>;<br />
<span class="kw2">var</span> maxLength:<span class="kw3">Number</span> = <span class="nu0">65</span>;</p>
<p><span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i=<span class="nu0">0</span>; i<span class="sy0">&lt;</span>_root.<span class="me1">myArray</span>.<span class="kw3">length</span>; i++ <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentCharCount<span class="sy0">&lt;</span>maxLength<span class="br0">&#41;</span> currentCharString += <span class="kw3">_root</span>.<span class="me1">myArray</span><span class="br0">&#91;</span>i<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentCharCount==maxLength <span class="sy0">||</span> currentCharItem==<span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">myArray</span>.<span class="me1">length</span>-1<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">_root</span>.<span class="me1">mySentences</span>.<span class="kw3">push</span><span class="br0">&#40;</span>currentCharString<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentCharCount = <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentCharString = <span class="st0">&quot;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; currentCharCount++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; currentCharItem++;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span>.<span class="kw3">length</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>2<span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</div>
<p>This outputs the following:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="nu0">3</span><br />
You got this far so we reckon that you could be curious enough to<br />
learn a little more<span class="sy0">,</span> we’ll contact you shortly to answer any que<br />
tions you may have.</div>
</div>
<p>Split string into sentences by max line length and use word-wrapping.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> personalMessage:<span class="kw3">String</span> = <span class="st0">&quot;You got this far so we reckon that you could be curious enough to learn a little more, we’ll contact you shortly to answer any questions you may have.&quot;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">myArray</span> = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">myArray</span> = personalMessage.<span class="kw3">split</span><span class="br0">&#40;</span><span class="st0">&quot; &quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">_root</span>.<span class="me1">mySentences</span> = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">var</span> currentCharString:<span class="kw3">String</span> = <span class="st0">&quot;&quot;</span>;<br />
<span class="kw2">var</span> maxLength:<span class="kw3">Number</span> = <span class="nu0">60</span>;</p>
<p><span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i=<span class="nu0">0</span>; i<span class="sy0">&lt;</span>_root.<span class="me1">myArray</span>.<span class="kw3">length</span>; i++ <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentCharString.<span class="me1">length</span><span class="sy0">&lt;</span>maxLength<span class="br0">&#41;</span> currentCharString += <span class="kw3">_root</span>.<span class="me1">myArray</span><span class="br0">&#91;</span>i<span class="br0">&#93;</span> + <span class="st0">&quot; &quot;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>currentCharString.<span class="kw3">length</span> <span class="sy0">&gt;</span>= <span class="br0">&#40;</span>maxLength-1<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <span class="br0">&#40;</span>i==<span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">myArray</span>.<span class="me1">length</span>-1<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">_root</span>.<span class="me1">mySentences</span>.<span class="kw3">push</span><span class="br0">&#40;</span>currentCharString<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentCharString = <span class="st0">&quot;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> currentCharCount++;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span>.<span class="kw3">length</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>0<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
<span class="kw3">trace</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="me1">mySentences</span><span class="br0">&#91;</span>2<span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</div>
<p>This outputs the following:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="nu0">3</span><br />
You got this far so we reckon that you could be curious enough<br />
to learn a little more<span class="sy0">,</span> we’ll contact you shortly to answer<br />
any questions you may have.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/split-string-by-line-length-with-and-without-word-wrap-using-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set line leading / line spacing in flash actionscript 2</title>
		<link>http://hsmoore.com/blog/set-line-leading-line-spacing-in-flash-actionscript-2/</link>
		<comments>http://hsmoore.com/blog/set-line-leading-line-spacing-in-flash-actionscript-2/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 15:14:40 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[actionscript 2]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[line spacing]]></category>
		<category><![CDATA[text leading]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=629</guid>
		<description><![CDATA[This is how to add text leading using Actionscript 2 for Flash. var txtFormat:TextFormat = new TextFormat&#40;&#41;; txtFormat.leading = 5; // change this to whatever you need it to be ttt.setTextFormat&#40;txtFormat&#41;; ttt2.setTextFormat&#40;txtFormat&#41;;&#60;/span&#62; There is also a GUI way of doing this: Select your textfield and and under the paragraph section, set the top/right hand icon...]]></description>
			<content:encoded><![CDATA[<p><strong>This is how to add text leading using Actionscript 2 for Flash.</strong></p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> txtFormat:<span class="kw3">TextFormat</span> = <span class="kw2">new</span> <span class="kw3">TextFormat</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
txtFormat.<span class="kw3">leading</span> = <span class="nu0">5</span>; <span class="co1">// change this to whatever you need it to be</span><br />
ttt.<span class="kw3">setTextFormat</span><span class="br0">&#40;</span>txtFormat<span class="br0">&#41;</span>;<br />
ttt2.<span class="kw3">setTextFormat</span><span class="br0">&#40;</span>txtFormat<span class="br0">&#41;</span>;<span class="sy0">&lt;/</span>span<span class="sy0">&gt;</span></div>
</div>
<p><strong>There is also a GUI way of doing this:</strong></p>
<p>Select your textfield and and under the paragraph section, set the top/right hand icon (Line Spacing) to whatever you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/set-line-leading-line-spacing-in-flash-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error 1046: Type was not found or was not a compile-time constant: Event.</title>
		<link>http://hsmoore.com/blog/error-1046-type-was-not-found-or-was-not-a-compile-time-constant-event/</link>
		<comments>http://hsmoore.com/blog/error-1046-type-was-not-found-or-was-not-a-compile-time-constant-event/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 20:10:48 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[1046]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=566</guid>
		<description><![CDATA[Error 1046: Type was not found or was not a compile-time constant: Event. You need to import the Event class! import flash.events.Event]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">Error 1046: Type was not found or was not a compile-time constant: Event.</span></p>
<p>You need to import the Event class!</p>
<p><span style="color: #0000ff;">import flash.events.Event</span></p>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/error-1046-type-was-not-found-or-was-not-a-compile-time-constant-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a date to a date in Actionscript 2</title>
		<link>http://hsmoore.com/blog/add-a-date-to-a-date-in-actionscript2/</link>
		<comments>http://hsmoore.com/blog/add-a-date-to-a-date-in-actionscript2/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 20:19:42 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[date]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=564</guid>
		<description><![CDATA[I needed to work out a date range according to the date 3weeks away from the current date. After a bit of thinking, I found that it&#8217;s actually quite easy to achieve. var theDate:Date = new Date&#40;&#41;; dateDay = theDate.getDate&#40;&#41;; dateMonth = theDate.getMonth&#40;&#41;; dateYear = theDate.getFullYear&#40;&#41;; var theDate2:Date = new Date&#40;dateYear,dateMonth,dateDay&#41;; theDate2.setDate&#40;theDate2.getDate&#40;&#41; + 21&#41;; dateDay2...]]></description>
			<content:encoded><![CDATA[<p>I needed to work out a date range according to the date 3weeks away from the current date.<br />
After a bit of thinking, I found that it&#8217;s actually quite easy to achieve.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> theDate:<span class="kw3">Date</span> = <span class="kw2">new</span> <span class="kw3">Date</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateDay = theDate.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateMonth = theDate.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateYear = theDate.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw2">var</span> theDate2:<span class="kw3">Date</span> = <span class="kw2">new</span> <span class="kw3">Date</span><span class="br0">&#40;</span>dateYear,dateMonth,dateDay<span class="br0">&#41;</span>;<br />
theDate2.<span class="kw3">setDate</span><span class="br0">&#40;</span>theDate2.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + 21<span class="br0">&#41;</span>;<br />
dateDay2 = theDate2.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateMonth2 = theDate2.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateYear2 = theDate2.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="sy0">&lt;/</span>span<span class="sy0">&gt;</span></div>
</div>
<p>The above code gets the current date and adds 21days/3weeks to it.<br />
Remember that if you use getMonth to output the final month number, you will want to add 1 to it as it starts at 0;<br />
Example:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">dateMonth2 = theDate2.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>+<span class="nu0">1</span>;</div>
</div>
<p>So you would do it like this:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">theDate2.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span> +<span class="st0">&quot;/&quot;</span>+ <span class="br0">&#40;</span>theDate2.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>+<span class="nu0">1</span><span class="br0">&#41;</span> +<span class="st0">&quot;/&quot;</span>+ theDate2.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/add-a-date-to-a-date-in-actionscript2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a month to selectable date range &#8211; Date Chooser &#8211; Actionscript 2</title>
		<link>http://hsmoore.com/blog/add-a-month-to-selectable-date-range-date-chooser-actionscript-2/</link>
		<comments>http://hsmoore.com/blog/add-a-month-to-selectable-date-range-date-chooser-actionscript-2/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 12:40:20 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[datechooser]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=562</guid>
		<description><![CDATA[I have been working on a project where I need to select a date range starting today and ending a month from now, so the user cannot select anything in the past or over a month from now. This is how I did it: There is an instance of DateChooser on the stage with Instance...]]></description>
			<content:encoded><![CDATA[<p>I have been working on a project where I need to select a date range starting today and ending a month from now, so the user cannot select anything in the past or over a month from now.</p>
<p>This is how I did it:</p>
<p>There is an instance of DateChooser on the stage with Instance Name &#8220;calDate&#8221;.</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw2">var</span> todayDate:<span class="kw3">Date</span> = <span class="kw2">new</span> <span class="kw3">Date</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateBeginDay = todayDate.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateBeginMonth = todayDate.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
dateBeginYear = todayDate.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>todayDate.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>+1<span class="br0">&#41;</span>==12<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndDay = todayDate.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndMonth = <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndYear = todayDate.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>+<span class="nu0">1</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndDay = todayDate.<span class="kw3">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndMonth = todayDate.<span class="kw3">getMonth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>+<span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dateEndYear = todayDate.<span class="kw3">getFullYear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
calDate.<span class="me1">selectableRange</span> = <span class="br0">&#123;</span>rangeStart: <span class="kw2">new</span> <span class="kw3">Date</span><span class="br0">&#40;</span>dateBeginYear, dateBeginMonth, dateBeginDay<span class="br0">&#41;</span>, rangeEnd: <span class="kw2">new</span> <span class="kw3">Date</span><span class="br0">&#40;</span>dateEndYear, dateEndMonth, dateEndDay<span class="br0">&#41;</span><span class="br0">&#125;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/add-a-month-to-selectable-date-range-date-chooser-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hitTest and Actionscript2</title>
		<link>http://hsmoore.com/blog/hittest-and-actionscript2/</link>
		<comments>http://hsmoore.com/blog/hittest-and-actionscript2/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 11:42:31 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[hitTest]]></category>

		<guid isPermaLink="false">http://www.andrewodendaal.com/?p=560</guid>
		<description><![CDATA[if &#40;mc.hitTest&#40;_root._xmouse, _root._ymouse, true&#41;&#41;&#41; &#123; &#160; &#160; &#160; &#160; trace&#40;&#34;hitTest Run&#34;&#41;; &#125;]]></description>
			<content:encoded><![CDATA[<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#40;</span>mc.<span class="kw3">hitTest</span><span class="br0">&#40;</span><span class="kw3">_root</span>.<span class="kw3">_xmouse</span>, <span class="kw3">_root</span>.<span class="kw3">_ymouse</span>, <span class="kw2">true</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span><span class="st0">&quot;hitTest Run&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hsmoore.com/blog/hittest-and-actionscript2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

