<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to use the modulo operator (%) in ActionScript</title>
	<atom:link href="http://flashexplained.com/actionscript/how-to-use-the-modulo-operator-in-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://flashexplained.com/actionscript/how-to-use-the-modulo-operator-in-actionscript/</link>
	<description>Learn Flash easily.</description>
	<lastBuildDate>Wed, 10 Mar 2010 11:23:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jason</title>
		<link>http://flashexplained.com/actionscript/how-to-use-the-modulo-operator-in-actionscript/comment-page-1/#comment-1614</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Mon, 14 Sep 2009 09:19:21 +0000</pubDate>
		<guid isPermaLink="false">http://flashexplained.com/?p=246#comment-1614</guid>
		<description>Yeah .. but the moduli does not work for negative numbers.

eg. i was had to use moduli 26, and i didn&#039;t have a calculator nearby, so i grabbed my laptop and scripted up some code and it works for negatives too

	\\variable is set to as ans1, inputtext is the text box
	\\26 is what you would use as the &quot;% 26&quot;
	\\Math.floor rounds the answer down to an integer
	ans1 = Math.floor(inputtext / 26);
	\\answer is a textbox set to display the answer
	answer = num1 - (ans1 * 26);

Hope this helps someone.</description>
		<content:encoded><![CDATA[<p>Yeah .. but the moduli does not work for negative numbers.</p>
<p>eg. i was had to use moduli 26, and i didn&#8217;t have a calculator nearby, so i grabbed my laptop and scripted up some code and it works for negatives too</p>
<p>	\\variable is set to as ans1, inputtext is the text box<br />
	\\26 is what you would use as the &#8220;% 26&#8243;<br />
	\\Math.floor rounds the answer down to an integer<br />
	ans1 = Math.floor(inputtext / 26);<br />
	\\answer is a textbox set to display the answer<br />
	answer = num1 &#8211; (ans1 * 26);</p>
<p>Hope this helps someone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luka</title>
		<link>http://flashexplained.com/actionscript/how-to-use-the-modulo-operator-in-actionscript/comment-page-1/#comment-180</link>
		<dc:creator>Luka</dc:creator>
		<pubDate>Fri, 24 Oct 2008 13:32:16 +0000</pubDate>
		<guid isPermaLink="false">http://flashexplained.com/?p=246#comment-180</guid>
		<description>&lt;b&gt;Marc&lt;/b&gt;: I have written the tutorial for one option only, which is much widely used. Your idea just didn&#039;t spring to mind at the time - thanks for the tip! Good info.</description>
		<content:encoded><![CDATA[<p><b>Marc</b>: I have written the tutorial for one option only, which is much widely used. Your idea just didn&#8217;t spring to mind at the time &#8211; thanks for the tip! Good info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://flashexplained.com/actionscript/how-to-use-the-modulo-operator-in-actionscript/comment-page-1/#comment-169</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Fri, 24 Oct 2008 00:46:38 +0000</pubDate>
		<guid isPermaLink="false">http://flashexplained.com/?p=246#comment-169</guid>
		<description>This is good as far as it goes, but it falls short of an important feature of modulo.

When any number (dividend) is divided by another number (divisor), modulo tells you what the remainder is. So modulo can be used with any divisor, not just the number 2. For example, I might want to know if a number is exactly divisible by 7:
someNumber: Number = 39;
if (someNumber % 7 ==0){
     trace (&quot;It&#039;s exactly divisible by 7!&quot;);
} else {
     trace (&quot;There&#039;s a remainder of &quot; + someNumber % 7);
}

Let&#039;s say you design a game and you want to ring a bell every 10 points. Each time the player scores, you could use modulo to determine if the new score is exactly divisible by 10, in which case you&#039;d ring the bell.</description>
		<content:encoded><![CDATA[<p>This is good as far as it goes, but it falls short of an important feature of modulo.</p>
<p>When any number (dividend) is divided by another number (divisor), modulo tells you what the remainder is. So modulo can be used with any divisor, not just the number 2. For example, I might want to know if a number is exactly divisible by 7:<br />
someNumber: Number = 39;<br />
if (someNumber % 7 ==0){<br />
     trace (&#8220;It&#8217;s exactly divisible by 7!&#8221;);<br />
} else {<br />
     trace (&#8220;There&#8217;s a remainder of &#8221; + someNumber % 7);<br />
}</p>
<p>Let&#8217;s say you design a game and you want to ring a bell every 10 points. Each time the player scores, you could use modulo to determine if the new score is exactly divisible by 10, in which case you&#8217;d ring the bell.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
