<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>ActionScript.org Forums</title>
		<link>http://www.actionscript.org/forums/</link>
		<description>ActionScript.org is a large online community for Macromedia Flash developers at all skill levels. We offer tutorials, open source, scripting assistance, book reviews, scene news and a means of contact between developers.</description>
		<language>en</language>
		<lastBuildDate>Sun, 26 May 2013 06:54:38 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.actionscript.org/forums/images/misc/rss.jpg</url>
			<title>ActionScript.org Forums</title>
			<link>http://www.actionscript.org/forums/</link>
		</image>
		<item>
			<title>about clicking on subject and continuing</title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279185&amp;goto=newpost</link>
			<pubDate>Sun, 26 May 2013 05:31:02 GMT</pubDate>
			<description><![CDATA[Hey guys I need help with action script 2.0 for flash. I'm totally new in this subject. 
There's this assignment where I need to include at least 1...]]></description>
			<content:encoded><![CDATA[<div>Hey guys I need help with action script 2.0 for flash. I'm totally new in this subject.<br />
There's this assignment where I need to include at least 1 action script in my animation and I've figured out what to do but I have no idea what keyword to search for this. So I hope someone can help me out.<br />
<br />
What I'm gonna do is that in my animation , there will be 3 items , let's say A,B,C and a person standing beside it. And then the user will click on either one of the items and the person will start talking about it,same goes to item B and C. Then there will be a continue button on corner right so I can proceed with the animation, also is it possible to make the item unclickable once being clicked?? so that the user will not be clicking on same item more than once.<br />
<br />
It'll be good if there's a you tube link or some video ,thanks :)<br />
<br />
<br />
<br />
PS: Yes ,only action script 2.0,cause my lecturer is using an outdated software ,so she asked to use only 2.0 lol</div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=35">ActionScript 2.0</category>
			<dc:creator>wong93</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279185</guid>
		</item>
		<item>
			<title><![CDATA[[CS3] Enemy car NOT moving help!]]></title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279184&amp;goto=newpost</link>
			<pubDate>Sun, 26 May 2013 01:38:08 GMT</pubDate>
			<description><![CDATA[Hey guys, this is my first time this year making an arcade-like game on Flash. It's supposed to be some road rage game that I hope to finish roughly...]]></description>
			<content:encoded><![CDATA[<div>Hey guys, this is my first time this year making an arcade-like game on Flash. It's supposed to be some road rage game that I hope to finish roughly around the beginning of June for uploading on YouTube.<br />
<br />
Problem is, the enemy car I'm trying to program...will NOT move.<br />
<br />
This is what i got by far:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border:1px inset; width:500px; height:516px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript"><span style="color: #993300;">onClipEvent</span><span style="color: #000000;">&#40;</span>enterFrame<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #993300;">control</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; <span style="color: #993300;">function</span> <span style="color: #993300;">control</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">var</span> dir = <span style="color: #000000;">3</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">var</span> timer = <span style="color: #000000;">25</span>;
&nbsp; &nbsp; &nbsp; &nbsp; movement = <span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span>dir<span style="color: #000000;">&#41;</span> + <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; accelerate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #993300;">function</span> accelerate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>movement == <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #000000;">x</span> -= <span style="color: #000000;">2</span>.<span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #000000;">y</span> += <span style="color: #000000;">6</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer--;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span> <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>movement == <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #000000;">y</span> += <span style="color: #000000;">6</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer--;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #000000;">x</span> += <span style="color: #000000;">2</span>.<span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #000000;">y</span> += <span style="color: #000000;">6</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer--;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #993300;">function</span> detect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>timer &gt; <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accelerate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
What I am trying to do here with this code is, to get my enemy car to change horizontal directions every certain period of time while it keeps accelerating south at 6 pixels per frame. <br />
<br />
Is there anyway I can get this to possibly work? If so, please reply asap. Thanks!<br />
<br />
If you got any questions relevant to this and the road rage game, ask it and I will find an answer!</div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=35">ActionScript 2.0</category>
			<dc:creator>BlueGalaxian</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279184</guid>
		</item>
		<item>
			<title>Keep getting 1120 errors, Please help this newbee!</title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279183&amp;goto=newpost</link>
			<pubDate>Sat, 25 May 2013 21:30:30 GMT</pubDate>
			<description>Totally fed up with this.  Modified some code from a tutorial to bring in 3 variables using flashvars via a swf embeded in a php page (php is my main...</description>
			<content:encoded><![CDATA[<div>Totally fed up with this.  Modified some code from a tutorial to bring in 3 variables using flashvars via a swf embeded in a php page (php is my main language).  The rtmp variable gets passed no problem, but the streamIn and streamOut throw 1120 compile errors.  I'm about ready to throw my system out the window.  Appreciate any suggestions/help.<br />
Thanks in advance!<br />
Here is the code:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">package <br />
{<br />
import flash.display.Sprite;<br />
import flash.net.NetConnection;<br />
import flash.net.NetStream;<br />
import flash.events.MouseEvent;<br />
import flash.events.NetStatusEvent;<br />
import flash.events.Event;<br />
import flash.media.Camera;<br />
import flash.media.Microphone;<br />
import flash.media.Video;<br />
import fl.controls.Button;<br />
import fl.controls.TextInput;<br />
import flash.display.Graphics;<br />
import flash.display.Shape;<br />
import flash.display.LoaderInfo;<br />
import flash.text.*;<br />
import flash.system.*;<br />
public class UniversalChat extends Sprite<br />
{<br />
<br />
private var nc:NetConnection;<br />
private var nsIn:NetStream;<br />
private var nsOut:NetStream;<br />
private var vidLocal:Video;<br />
private var vidRemote:Video;<br />
private var startStreamOut:Button;<br />
private var startStreamIn:Button;<br />
//private var streamIn:TextInput;<br />
//private var streamOut:TextInput;<br />
private var cam:Camera;<br />
private var mic:Microphone;<br />
private var connectShape:Shape;<br />
private var serverName:String;<br />
//private var streamIn:String;<br />
//private var guestName:String;<br />
<br />
<br />
<br />
public function UniversalChat()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
var paramObjsn:Object = LoaderInfo(this.root.loaderInfo).parameters.serverName;<br />
var paramObjun:Object = LoaderInfo(this.root.loaderInfo).parameters.userName;<br />
var paramObjgn:Object = LoaderInfo(this.root.loaderInfo).parameters.guestName;<br />
<br />
var rtmpNow:String = paramObjsn.toString();&nbsp; &nbsp; &nbsp; &nbsp; <br />
var streamOut:String = paramObjun.toString();<br />
var streamIn:String = paramObjgn.toString();&nbsp; &nbsp; &nbsp; &nbsp; <br />
//var streamIn = userIn;<br />
nc=new NetConnection ;<br />
nc.connect(rtmpNow);<br />
nc.addEventListener(NetStatusEvent.NET_STATUS,checkConnect);<br />
vidLocal=new Video(120,90);<br />
vidRemote=new Video(320,240);<br />
//Camera<br />
cam=Camera.getCamera();<br />
cam.setMode(320,240,20);<br />
cam.setQuality(0,80);<br />
cam.setKeyFrameInterval(20);<br />
//Microphone<br />
mic=Microphone.getMicrophone();<br />
mic.setUseEchoSuppression(true);<br />
mic.setSilenceLevel(20,-1);<br />
mic.rate=11;<br />
//Video<br />
vidLocal=new Video(120,90);<br />
vidLocal.attachCamera(cam);<br />
vidLocal.x=20,vidLocal.y=50;<br />
addChild(vidLocal);<br />
vidRemote=new Video(320,240);<br />
vidRemote.x=200,vidRemote.y=20;<br />
addChild(vidRemote);<br />
}<br />
<br />
private function checkConnect(e:NetStatusEvent)<br />
{<br />
if (e.info.code==&quot;NetConnection.Connect.Success&quot;)<br />
{<br />
nsOut=new NetStream(nc);<br />
nsIn=new NetStream(nc);<br />
}<br />
}<br />
<br />
private function goOut()<br />
{<br />
if (streamOut.String!=&quot;&quot;)<br />
{<br />
nsOut.attachAudio(mic);<br />
nsOut.attachCamera(cam);<br />
nsOut.publish(streamOut.String);<br />
}<br />
else<br />
{<br />
streamOut.String=&quot;&lt;add stream name&gt;&quot;;<br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=75">ActionScript 3.0</category>
			<dc:creator>WetElvis</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279183</guid>
		</item>
		<item>
			<title>Game Over Screen help.</title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279182&amp;goto=newpost</link>
			<pubDate>Sat, 25 May 2013 12:29:17 GMT</pubDate>
			<description><![CDATA[So for school the assignment is to make a game with AS2. What I'm going for is a sort of avoider game where enemies scroll up from the bottom of the...]]></description>
			<content:encoded><![CDATA[<div>So for school the assignment is to make a game with AS2. What I'm going for is a sort of avoider game where enemies scroll up from the bottom of the screen and the player avoids them. I have the enemies scrolling up and resetting at a random position at the bottom of the screen again, but when the player hits an enemy the enemies keep scrolling and restting. I'm not very used to AS or coding in general, but I tried adapting various tutorial codes for this to work, but to no avail yet. I hope you guys can make sense of all this.<br />
<br />
<br />
The code on the enemy mc is as follows:<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border:1px inset; width:500px; height:516px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript"><span style="color: #993300;">onClipEvent</span> <span style="color: #000000;">&#40;</span><span style="color: #993300;">load</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>

&nbsp;<span style="color: #993300;">function</span> reset<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #993300;">_y</span>=<span style="color: #000000;">400</span>;
&nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #993300;">_x</span>=<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">550</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; enemySpeed=<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">4</span><span style="color: #000000;">&#41;</span>+<span style="color: #000000;">3</span>;
&nbsp;<span style="color: #000000;">&#125;</span>
&nbsp;<span style="color: #993300;">function</span> reset2<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #993300;">_y</span>=<span style="color: #000000;">500</span>;
&nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #993300;">_x</span>=<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">550</span><span style="color: #000000;">&#41;</span>+<span style="color: #000000;">550</span>;
&nbsp; &nbsp; enemySpeed=<span style="color: #000000;">0</span>;
&nbsp; &nbsp; <span style="color: #993300;">this</span>.<span style="color: #993300;">_alpha</span>=<span style="color: #000000;">0</span>;
&nbsp;<span style="color: #000000;">&#125;</span>
&nbsp;reset<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;<span style="color: #993300;">var</span> taart:<span style="color: #993300;">Boolean</span> = <span style="color: #993300;">false</span>
&nbsp;
&nbsp;<span style="color: #000000;">&#125;</span>


<span style="color: #993300;">onClipEvent</span> <span style="color: #000000;">&#40;</span>enterFrame<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>

&nbsp;<span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #993300;">_root</span>.<span style="color: #000000;">spaceship</span>.<span style="color: #000000;">scrollStart</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #993300;">this</span>._y-=enemySpeed+<span style="color: #993300;">_root</span>.<span style="color: #000000;">mainGround</span>.<span style="color: #000000;">groundSpeed</span>;
&nbsp;<span style="color: #000000;">&#125;</span> <span style="color: #993300;">else</span> <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #993300;">this</span>._y-=enemySpeed;
&nbsp;<span style="color: #000000;">&#125;</span>


&nbsp;<span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #993300;">this</span>._y&lt;-<span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp;&nbsp; <span style="color: #993300;">_root</span>.<span style="color: #000000;">score</span>+=<span style="color: #000000;">100</span>;
&nbsp; &nbsp; reset<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;<span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;<span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #993300;">this</span>._y&lt;-<span style="color: #000000;">10</span> &amp;&amp; taart==<span style="color: #993300;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; reset2<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>

&nbsp;<span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #993300;">this</span>.<span style="color: #993300;">hitTest</span><span style="color: #000000;">&#40;</span> <span style="color: #993300;">_root</span>.<span style="color: #000000;">spaceship</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp; &nbsp;&nbsp; taart = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; <span style="color: #993300;">_root</span>.<span style="color: #993300;">gotoAndPlay</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; 
<span style="color: #000000;">&#125;</span>


<span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
On the frame there is the following script:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border:1px inset; width:500px; height:196px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript"><span style="color: #993300;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;

numEnemy=<span style="color: #000000;">3</span>;

<span style="color: #993300;">for</span> <span style="color: #000000;">&#40;</span>i=<span style="color: #000000;">2</span>; i&lt;=numEnemy; i++<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; enemy1.<span style="color: #993300;">duplicateMovieClip</span><span style="color: #000000;">&#40;</span> <span style="color: #0000FF;">"enemy"</span>+i, i+<span style="color: #000000;">100</span> <span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; 
<span style="color: #000000;">&#125;</span>

score=<span style="color: #000000;">0</span>;</div></div></pre>
</div></div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=35">ActionScript 2.0</category>
			<dc:creator>Pizzadude</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279182</guid>
		</item>
		<item>
			<title>need help on timer at math quiz</title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279181&amp;goto=newpost</link>
			<pubDate>Sat, 25 May 2013 10:06:07 GMT</pubDate>
			<description>Hello, I have problem on my code regarding timer. 
 
The below code is about math quiz game, which player only have 1 min to answer all the 30 random...</description>
			<content:encoded><![CDATA[<div>Hello, I have problem on my code regarding timer.<br />
<br />
The below code is about math quiz game, which player only have 1 min to answer all the 30 random math question, if 1 min is out or 30 question have been answer, the game will end.<br />
<br />
<br />
Firstly how can I set the current timer count if the answer is wrong will minus 10 sec of the time<br />
<br />
Secondly mine <br />
if (Question &gt; 30 || myTimer.currentCount &gt;60 )<br />
			{<br />
				gotoAndStop(5);<br />
			}<br />
is not working<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">ActionScript Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border:1px inset; width:500px; height:516px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="actionscript">package 
<span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Add in your import statements here</span>
&nbsp; &nbsp; <span style="color: #993300;">import</span> flash.<span style="color: #000000;">display</span>.*;
&nbsp; &nbsp; <span style="color: #993300;">import</span> flash.<span style="color: #000000;">events</span>.*;
&nbsp; &nbsp; <span style="color: #993300;">import</span> flash.<span style="color: #000000;">utils</span>.<span style="color: #000000;">Timer</span>;
&nbsp; &nbsp; <span style="color: #993300;">import</span> flash.<span style="color: #000000;">events</span>.<span style="color: #000000;">TimerEvent</span>;

&nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//...</span>


&nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">class</span> MathsQuiz <span style="color: #993300;">extends</span> <span style="color: #993300;">MovieClip</span>
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Add in your class variables here</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> score:<span style="color: #993300;">Number</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> operand1:<span style="color: #993300;">Number</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> operand2:<span style="color: #993300;">Number</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> startNewGame:<span style="color: #993300;">Boolean</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> Oper:<span style="color: #993300;">int</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">var</span> Question:<span style="color: #993300;">int</span> = <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">var</span> delay:uint = <span style="color: #000000;">1000</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">var</span> repeat:uint = <span style="color: #000000;">60</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">var</span> myTimer:Timer = <span style="color: #993300;">new</span> Timer<span style="color: #000000;">&#40;</span>delay,repeat<span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//...</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">function</span> MathsQuiz<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">private</span> <span style="color: #993300;">function</span> checkAnswer<span style="color: #000000;">&#40;</span>evt:KeyboardEvent<span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">var</span> userInput:<span style="color: #993300;">int</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">var</span> correctAns:<span style="color: #993300;">int</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">switch</span> <span style="color: #000000;">&#40;</span>Oper<span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">0</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>evt.<span style="color: #000000;">keyCode</span> == <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userInput = <span style="color: #993300;">Number</span><span style="color: #000000;">&#40;</span>txtResult.<span style="color: #993300;">text</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; correctAns = operand1 + operand2;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>userInput == correctAns<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score +=&nbsp; <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Question +=&nbsp; <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score -=&nbsp; <span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #000000;">currentCount</span> += <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtResult.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">""</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">1</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>evt.<span style="color: #000000;">keyCode</span> == <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userInput = <span style="color: #993300;">Number</span><span style="color: #000000;">&#40;</span>txtResult.<span style="color: #993300;">text</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; correctAns = operand1 - operand2;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>userInput == correctAns<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score +=&nbsp; <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Question +=&nbsp; <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score -=&nbsp; <span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #000000;">currentCount</span> += <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtResult.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">""</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">2</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>evt.<span style="color: #000000;">keyCode</span> == <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userInput = <span style="color: #993300;">Number</span><span style="color: #000000;">&#40;</span>txtResult.<span style="color: #993300;">text</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; correctAns = operand1 * operand2;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>userInput == correctAns<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score +=&nbsp; <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Question +=&nbsp; <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score -=&nbsp; <span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #000000;">currentCount</span> += <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtResult.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">""</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">3</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>evt.<span style="color: #000000;">keyCode</span> == <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; userInput = <span style="color: #993300;">Number</span><span style="color: #000000;">&#40;</span>txtResult.<span style="color: #993300;">text</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; correctAns = operand1 / operand2;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>userInput == correctAns<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score +=&nbsp; <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Question +=&nbsp; <span style="color: #000000;">1</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score -=&nbsp; <span style="color: #000000;">5</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #000000;">currentCount</span> += <span style="color: #000000;">10</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtResult.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">""</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">function</span> startGame<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score = <span style="color: #000000;">0</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = <span style="color: #000000;">0</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = <span style="color: #000000;">0</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Oper = <span style="color: #000000;">0</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span>TimerEvent.<span style="color: #000000;">TIMER</span>, update<span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTimer.<span style="color: #993300;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Get the game loop to execute</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addEventListener<span style="color: #000000;">&#40;</span>Event.<span style="color: #000000;">ENTER_FRAME</span>,update<span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">stage</span>.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span>KeyboardEvent.<span style="color: #000000;">KEY_DOWN</span>,checkAnswer<span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>



&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">public</span> <span style="color: #993300;">function</span> update<span style="color: #000000;">&#40;</span>evt:Event<span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//This is the game loop</span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Handle user input</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//advanced feature addon:</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">// how to handle non-number input</span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Handle game logic</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//math.random() =</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//real number range is from 0.0 to 1</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">// or MATH.floor(Math.random()*13)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>Question &gt; <span style="color: #000000;">30</span> || myTimer.<span style="color: #000000;">currentCount</span> &gt;<span style="color: #000000;">60</span> <span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">else</span> <span style="color: #993300;">if</span> <span style="color: #000000;">&#40;</span>startNewGame<span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = <span style="color: #993300;">int</span><span style="color: #000000;">&#40;</span><span style="color: #993300;">Math</span>.<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = <span style="color: #993300;">int</span><span style="color: #000000;">&#40;</span><span style="color: #993300;">Math</span>.<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #000000;">13</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Oper = <span style="color: #993300;">Math</span>.<span style="color: #993300;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #993300;">Math</span>.<span style="color: #993300;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> * <span style="color: #000000;">4</span><span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startNewGame = <span style="color: #993300;">false</span>;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">switch</span> <span style="color: #000000;">&#40;</span>Oper<span style="color: #000000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">0</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOper.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">"+"</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">1</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOper.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">"-"</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">2</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOper.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">"*"</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">case</span> <span style="color: #000000;">3</span> :
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOper.<span style="color: #993300;">text</span> = <span style="color: #0000FF;">"/"</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993300;">break</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F000F0; font-style: italic;">//Handle display</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOperand1.<span style="color: #993300;">text</span> = <span style="color: #993300;">String</span><span style="color: #000000;">&#40;</span>operand1<span style="color: #000000;">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtOperand2.<span style="color: #993300;">text</span> = <span style="color: #993300;">String</span><span style="color: #000000;">&#40;</span>operand2<span style="color: #000000;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtScore.<span style="color: #993300;">text</span> = <span style="color: #993300;">String</span><span style="color: #000000;">&#40;</span>score<span style="color: #000000;">&#41;</span>;

&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><span style="color: #F000F0; font-style: italic;">//end class</span>
<span style="color: #000000;">&#125;</span><span style="color: #F000F0; font-style: italic;">//end package </span></div></div></pre>
</div></div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=75">ActionScript 3.0</category>
			<dc:creator>nmthmd</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279181</guid>
		</item>
		<item>
			<title>PAC adventure game engine</title>
			<link>http://www.actionscript.org/forums/showthread.php3?t=279180&amp;goto=newpost</link>
			<pubDate>Sat, 25 May 2013 09:22:37 GMT</pubDate>
			<description>Hello I am creating a new game engine for Flash named PAC. It will be used to create flash adventure games and will come with a huge bundle of...</description>
			<content:encoded><![CDATA[<div>Hello I am creating a new game engine for Flash named PAC. It will be used to create flash adventure games and will come with a huge bundle of classes to use eventually. Just wanted to know what things do I need to consider when setting up this engine? I have made use of Tweenlite as part of the engine is this acceptable?<br />
<br />
Any contributions to make it better would be great also!<br />
<br />
It can be found at smks-pac on github</div>

]]></content:encoded>
			<category domain="http://www.actionscript.org/forums/forumdisplay.php3?f=75">ActionScript 3.0</category>
			<dc:creator>smks</dc:creator>
			<guid isPermaLink="true">http://www.actionscript.org/forums/showthread.php3?t=279180</guid>
		</item>
	</channel>
</rss>
