<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: An ActionScript 3.0 Recursion Excursion</title>
	<atom:link href="http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/</link>
	<description>OOP Techniques for Flash and Flex Developers</description>
	<lastBuildDate>Sat, 28 Aug 2010 21:46:42 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-5312</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Thu, 08 Jul 2010 14:40:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-5312</guid>
		<description>Hi Joxnas,

I tend to agree with you. In talking with the chair of the Computer Science Dept. at my university, he said the same thing. The stack overflow issues must be considered, but if you implement a recursive operation correctly, you&#039;re not going to have that problem anyway.

Oddly, I&#039;ve been having difficult time articulating why I like recursion more than loops other than they seem to better reveal what&#039;s going on and I like the way they use the stack. So all of your points are well-taken.

Kindest regards,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Joxnas,</p>
<p>I tend to agree with you. In talking with the chair of the Computer Science Dept. at my university, he said the same thing. The stack overflow issues must be considered, but if you implement a recursive operation correctly, you&#8217;re not going to have that problem anyway.</p>
<p>Oddly, I&#8217;ve been having difficult time articulating why I like recursion more than loops other than they seem to better reveal what&#8217;s going on and I like the way they use the stack. So all of your points are well-taken.</p>
<p>Kindest regards,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joxnas</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-5311</link>
		<dc:creator>joxnas</dc:creator>
		<pubDate>Thu, 08 Jul 2010 12:38:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-5311</guid>
		<description>I&#039;m not an expert in actionscript... I think recursion is much more powerfull then looping with a for or a while statement. (even thought most of times less efficient). But with recursion you can treat recursive structures in a breeze, like binary trees (not very used in actioscript, i know..) or doing a floodfill algorithm. Recursion allows going throught ramifications while looping is a linear operation...

By the way, In my university, I learned recursion before loops too.. :D (Haskell first where recursion is a must before C)</description>
		<content:encoded><![CDATA[<p>I&#8217;m not an expert in actionscript&#8230; I think recursion is much more powerfull then looping with a for or a while statement. (even thought most of times less efficient). But with recursion you can treat recursive structures in a breeze, like binary trees (not very used in actioscript, i know..) or doing a floodfill algorithm. Recursion allows going throught ramifications while looping is a linear operation&#8230;</p>
<p>By the way, In my university, I learned recursion before loops too.. :D (Haskell first where recursion is a must before C)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-4157</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Mon, 15 Mar 2010 20:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-4157</guid>
		<description>Hi Davit,

First of all, no need to apologize for your English—it&#039;s much better than my Russian.

You have so much code here that it&#039;s hard to untangle. Here&#039;s what I&#039;d suggest:

Create a series of 1 ball (or square) with 1 recursion. Start with something simple that works to generate your objects (or array elements).

Right now, you have several classes that you have not defined in the code you sent. square is a class, but I have no idea what is in it.

So, first back up into a workable recursive algorithm (one that was used in the example or from elsewhere.) Then, with a simple recursive algorithm, one thing (a ball or square). Then add from that point.

If you can, put them into a design pattern so that you can re-use the code.

Kindest regards,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Davit,</p>
<p>First of all, no need to apologize for your English—it&#8217;s much better than my Russian.</p>
<p>You have so much code here that it&#8217;s hard to untangle. Here&#8217;s what I&#8217;d suggest:</p>
<p>Create a series of 1 ball (or square) with 1 recursion. Start with something simple that works to generate your objects (or array elements).</p>
<p>Right now, you have several classes that you have not defined in the code you sent. square is a class, but I have no idea what is in it.</p>
<p>So, first back up into a workable recursive algorithm (one that was used in the example or from elsewhere.) Then, with a simple recursive algorithm, one thing (a ball or square). Then add from that point.</p>
<p>If you can, put them into a design pattern so that you can re-use the code.</p>
<p>Kindest regards,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davit</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-4155</link>
		<dc:creator>Davit</dc:creator>
		<pubDate>Mon, 15 Mar 2010 15:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-4155</guid>
		<description>Hi i want to write game lines and I want to employ recursion when we want to move ball from one place to another place;I want to create a recursive function where we must keep neighbor bars of bar where we want to move the ball, I haven&#039;t any library elements. What  advisory you give,and can you say what&#039;s wrong here?  Thank you very much and I am apologize for my bad English</description>
		<content:encoded><![CDATA[<p>Hi i want to write game lines and I want to employ recursion when we want to move ball from one place to another place;I want to create a recursive function where we must keep neighbor bars of bar where we want to move the ball, I haven&#8217;t any library elements. What  advisory you give,and can you say what&#8217;s wrong here?  Thank you very much and I am apologize for my bad English</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-4154</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Mon, 15 Mar 2010 15:22:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-4154</guid>
		<description>Hi Davit,

What&#039;s this supposed to do and what does it have to do with recursion? Or design patterns? What library elements do your have?

Thanks,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Davit,</p>
<p>What&#8217;s this supposed to do and what does it have to do with recursion? Or design patterns? What library elements do your have?</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davit</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-4153</link>
		<dc:creator>Davit</dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-4153</guid>
		<description>what is wrong here i beginer please help me
&lt;pre lang=&quot;actionscript&quot;&gt;
var freeBarArray:Array=new Array();
var score:Number=0;
var barArray:Array=new Array();
var freeArray:Array=[];
var inballArray:Array=new Array();
/*for(i=0;i&lt;15;i++){
	inballArray[i]=new Array();
	for(j=0;j&lt;15;j++){
		inballArray[i][j]=0;
	}
}*/

trace(&quot;aa&quot;);
for(var i:Number=0;i&lt;9;i++){
	 barArray[i]=new Array();
	 for(var j:Number=0;j&lt;9;j++){
		 var bar:square=new square();
		 barArray[i].push(bar);
		 addChild(barArray[i][j]);
		 barArray[i][j].x+=j*50;
         barArray[i][j].y+=i*50;
		 freeArray.push(bar);
		 freeArray[i].i=i;
		 freeArray[i].j=j;
		 } 
}
var ballArray:Array=new Array();
 function  randingBall(): void{
	var randCord:Number=Math.round(Math.random()*(freeArray.length-1));
	var randNum:Number=Math.round(Math.random()*5);
	var ballX:Number;
	var ballY:Number;
	switch (randNum){
		case 0:
		var blackBall:blackCircle=new blackCircle;
		ballX=randCord%10;
		ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(blackBall);
		
		inballArray[ballY][ballX+4]=blackBall;
		blackBall.i=ballY;
		blackBall.j=ballX;
		ballArray.push(blackBall);
		//barArray[ballY].splice(ballX,1);
		freeArray.splice(randCord,1);
		break;
		case 1:
		var whiteBall:whiteCircle=new whiteCircle;
		 ballX=randCord%10;
		 ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(whiteBall);
		inballArray[ballY][ballX+4]=whiteBall;
		whiteBall.i=ballY;
		whiteBall.j=ballX;
		ballArray.push(whiteBall);
		//barArray[ballY].splice(ballX,1);
		freeArray.splice(randCord,1);
		break;
		case 2:
		var redBall:redCircle=new redCircle;
		 ballX=randCord%10;
		 ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(redBall);
		inballArray[ballY][ballX+4]=redBall;
		redBall.i=ballY;
		redBall.j=ballX;
		ballArray.push(redBall);
		//barArray[ballY].splice(ballX,1)
		freeArray.splice(randCord,1);
		break;
		case 3:
		var blueBall:blueCircle=new blueCircle;
		ballX=randCord%10;
		ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(blueBall);
		inballArray[ballY][ballX+4]=blueBall;
		blueBall.i=ballY;
		blueBall.j=ballX;
		ballArray.push(blueBall);
		//barArray[ballY].splice(ballX,1);
		freeArray.splice(randCord,1);		
				break;
		case 4:
		var greenBall:greenCircle=new greenCircle;
		 ballX=randCord%10;
		 ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(greenBall);
		inballArray[ballY][ballX+4]=greenBall;
		greenBall.i=ballY;
		greenBall.j=ballX;
		ballArray.push(greenBall);
		//barArray[ballY].splice(ballX,1);
		freeArray.splice(randCord,1);
		break;
		case 5:
		var orangeBall:orangeCircle=new orangeCircle;
		 ballX=randCord%10;
		 ballY=Math.floor(randCord/10);
		barArray[freeArray[randCord].i][freeArray[randCord].j].addChild(orangeBall);
		inballArray[ballY][ballX+4]=orangeBall;
		orangeBall.i=ballY;
		orangeBall.j=ballX;		
	    ballArray.push(orangeBall);
		//barArray[ballY].splice(ballX,1);
		freeArray.splice(randCord,1);
		break;
	}
 }
/*function ballMayGoThere():void{
}*/
	trace(&quot;cc&quot;) 
 randingBall();
 randingBall();
 randingBall();

trace(&quot;bb&quot;);
for(var k:Number=0;k&lt;ballArray.length;k++){
	ballArray[k].addEventListener(MouseEvent.CLICK,moveingBall);
}

var ball:MovieClip;
function moveingBall(event:MouseEvent):void {
		ball = event.target as MovieClip;
		ball.width=30;
		ball.height=30;
		for(var i:Number=0;i&lt;barArray.length;i++){
			for(var j:Number=0;j&lt;barArray[i].length;j++){
				barArray[i][j].addEventListener(MouseEvent.CLICK,aa);
			    barArray[i][j].i=i;
				barArray[i][j].j=j;
				freeArray.push(bar);
				freeArray[freeArray.length].i=i;
				freeArray[freeArray.length].j=j;
				
			}
		}
}
function aa(event:MouseEvent):void{
	var qarakusi:MovieClip = event.target as MovieClip;
	qarakusi.addChild(ball);
	ball.i=qarakusi.i;
	ball.j=qarakusi.j;
	ball.width=50;
	ball.height=50;
	for(i=0;i&lt;9;i++){
		for(j=0;j&lt;9;j++){
			barArray[i][j].removeEventListener(MouseEvent.CLICK,aa);
		}
	}
	//barArray[ball.i].splice(ball.j,0,bar);
	trace(&quot;aa&quot;);
	/*for(i=0;i&lt;9;i++){
		for(j=0;j&lt;9;j++){
			if (inballArray[i][j]==inballArray[i][j+1]==inballArray[i][j+2]==inballArray[i][j+3]==inballArray[i][j+4]){
				for(k=0;k&lt;4;k++){
					barArray[i][j+k].removeChild(inballArray[i][j+k]);
				}
				score+=5;
			}
		     if (inballArray[i][j]==inballArray[i+1][j+1]==inballArray[i+2][j+2]==inballArray[i+3][j+3]==inballArray[i+4][j+4]){
				for(k=0;k&lt;4;k++){
					barArray[i+k][j+k].removeChild(inballArray[i][j+k]);
				}
				score+=5;
			 }
			 if (inballArray[i][j]==inballArray[i+1][j]==inballArray[i+2][j]==inballArray[i+3][j]==inballArray[i+4][j]){
				for(k=0;k&lt;4;k++){
					barArray[i+k][j].removeChild(inballArray[i+k][j]);
				}
				score+=5
			 }
			if (inballArray[i][j]==inballArray[i+1][j-1]==inballArray[i+2][j-2]==inballArray[i+3][j-3]==inballArray[i-4][j+4]){
				for(k=0;k&lt;4;k++){
					barArray[i+k][j-k].removeChild(inballArray[i+k][j-k]);
				}
				score+=5;
			}
		}
	}*/
	
			
	randingBall();
	randingBall();
	randingBall();
	trace(&quot;bb&quot;);
	
	for(var k:Number=0;k&lt;ballArray.length;k++){
	trace(&quot;cc&quot;);
	ballArray[k].addEventListener(MouseEvent.CLICK,moveingBall);
}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>what is wrong here i beginer please help me</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p256code1'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2561"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
</pre></td><td class="code" id="p256code1"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> freeBarArray:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> score:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
<span style="color: #000000; font-weight: bold;">var</span> barArray:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> freeArray:<span style="color: #0066CC;">Array</span>=<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #000000; font-weight: bold;">var</span> inballArray:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">/*for(i=0;i&amp;lt;15;i++){
	inballArray[i]=new Array();
	for(j=0;j&amp;lt;15;j++){
		inballArray[i][j]=0;
	}
}*/</span>
&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;aa<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;i<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">9</span>;i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	 barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	 <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;j<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">9</span>;j++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		 <span style="color: #000000; font-weight: bold;">var</span> bar:square=<span style="color: #000000; font-weight: bold;">new</span> square<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		 barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>bar<span style="color: #66cc66;">&#41;</span>;
		 addChild<span style="color: #66cc66;">&#40;</span>barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
		 barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">x</span>+=j<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">50</span>;
         barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">y</span>+=i<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">50</span>;
		 freeArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>bar<span style="color: #66cc66;">&#41;</span>;
		 freeArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span>=i;
		 freeArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span>=j;
		 <span style="color: #66cc66;">&#125;</span> 
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">var</span> ballArray:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 <span style="color: #000000; font-weight: bold;">function</span>  randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> randCord:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#40;</span>freeArray.<span style="color: #006600;">length</span>-<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> randNum:<span style="color: #0066CC;">Number</span>=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> ballX:<span style="color: #0066CC;">Number</span>;
	<span style="color: #000000; font-weight: bold;">var</span> ballY:<span style="color: #0066CC;">Number</span>;
	<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span>randNum<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">0</span>:
		<span style="color: #000000; font-weight: bold;">var</span> blackBall:blackCircle=<span style="color: #000000; font-weight: bold;">new</span> blackCircle;
		ballX=randCord<span style="color: #66cc66;">%</span>10;
		ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>blackBall<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=blackBall;
		blackBall.<span style="color: #006600;">i</span>=ballY;
		blackBall.<span style="color: #006600;">j</span>=ballX;
		ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>blackBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1);</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span>:
		<span style="color: #000000; font-weight: bold;">var</span> whiteBall:whiteCircle=<span style="color: #000000; font-weight: bold;">new</span> whiteCircle;
		 ballX=randCord<span style="color: #66cc66;">%</span>10;
		 ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>whiteBall<span style="color: #66cc66;">&#41;</span>;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=whiteBall;
		whiteBall.<span style="color: #006600;">i</span>=ballY;
		whiteBall.<span style="color: #006600;">j</span>=ballX;
		ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>whiteBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1);</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span>:
		<span style="color: #000000; font-weight: bold;">var</span> redBall:redCircle=<span style="color: #000000; font-weight: bold;">new</span> redCircle;
		 ballX=randCord<span style="color: #66cc66;">%</span>10;
		 ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>redBall<span style="color: #66cc66;">&#41;</span>;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=redBall;
		redBall.<span style="color: #006600;">i</span>=ballY;
		redBall.<span style="color: #006600;">j</span>=ballX;
		ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>redBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1)</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">3</span>:
		<span style="color: #000000; font-weight: bold;">var</span> blueBall:blueCircle=<span style="color: #000000; font-weight: bold;">new</span> blueCircle;
		ballX=randCord<span style="color: #66cc66;">%</span>10;
		ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>blueBall<span style="color: #66cc66;">&#41;</span>;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=blueBall;
		blueBall.<span style="color: #006600;">i</span>=ballY;
		blueBall.<span style="color: #006600;">j</span>=ballX;
		ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>blueBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1);</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;		
				<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">4</span>:
		<span style="color: #000000; font-weight: bold;">var</span> greenBall:greenCircle=<span style="color: #000000; font-weight: bold;">new</span> greenCircle;
		 ballX=randCord<span style="color: #66cc66;">%</span>10;
		 ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>greenBall<span style="color: #66cc66;">&#41;</span>;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=greenBall;
		greenBall.<span style="color: #006600;">i</span>=ballY;
		greenBall.<span style="color: #006600;">j</span>=ballX;
		ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>greenBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1);</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">5</span>:
		<span style="color: #000000; font-weight: bold;">var</span> orangeBall:orangeCircle=<span style="color: #000000; font-weight: bold;">new</span> orangeCircle;
		 ballX=randCord<span style="color: #66cc66;">%</span>10;
		 ballY=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>randCord<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
		barArray<span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>freeArray<span style="color: #66cc66;">&#91;</span>randCord<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>orangeBall<span style="color: #66cc66;">&#41;</span>;
		inballArray<span style="color: #66cc66;">&#91;</span>ballY<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>ballX+<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span>=orangeBall;
		orangeBall.<span style="color: #006600;">i</span>=ballY;
		orangeBall.<span style="color: #006600;">j</span>=ballX;		
	    ballArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>orangeBall<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">//barArray[ballY].splice(ballX,1);</span>
		freeArray.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>randCord,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">break</span>;
	<span style="color: #66cc66;">&#125;</span>
 <span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*function ballMayGoThere():void{
}*/</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;cc<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span> 
 randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;bb<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> k:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;k<span style="color: #66cc66;">&amp;</span>lt;ballArray.<span style="color: #0066CC;">length</span>;k++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	ballArray<span style="color: #66cc66;">&#91;</span>k<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,moveingBall<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> ball:<span style="color: #0066CC;">MovieClip</span>;
<span style="color: #000000; font-weight: bold;">function</span> moveingBall<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
		ball = event.<span style="color: #0066CC;">target</span> as <span style="color: #0066CC;">MovieClip</span>;
		ball.<span style="color: #0066CC;">width</span>=<span style="color: #cc66cc;">30</span>;
		ball.<span style="color: #0066CC;">height</span>=<span style="color: #cc66cc;">30</span>;
		<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;i<span style="color: #66cc66;">&amp;</span>lt;barArray.<span style="color: #0066CC;">length</span>;i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;j<span style="color: #66cc66;">&amp;</span>lt;barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">length</span>;j++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,aa<span style="color: #66cc66;">&#41;</span>;
			    barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span>=i;
				barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span>=j;
				freeArray.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>bar<span style="color: #66cc66;">&#41;</span>;
				freeArray<span style="color: #66cc66;">&#91;</span>freeArray.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">i</span>=i;
				freeArray<span style="color: #66cc66;">&#91;</span>freeArray.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">j</span>=j;
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> aa<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> qarakusi:<span style="color: #0066CC;">MovieClip</span> = event.<span style="color: #0066CC;">target</span> as <span style="color: #0066CC;">MovieClip</span>;
	qarakusi.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>ball<span style="color: #66cc66;">&#41;</span>;
	ball.<span style="color: #006600;">i</span>=qarakusi.<span style="color: #006600;">i</span>;
	ball.<span style="color: #006600;">j</span>=qarakusi.<span style="color: #006600;">j</span>;
	ball.<span style="color: #0066CC;">width</span>=<span style="color: #cc66cc;">50</span>;
	ball.<span style="color: #0066CC;">height</span>=<span style="color: #cc66cc;">50</span>;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i=<span style="color: #cc66cc;">0</span>;i<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">9</span>;i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>j=<span style="color: #cc66cc;">0</span>;j<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">9</span>;j++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			barArray<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,aa<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #808080; font-style: italic;">//barArray[ball.i].splice(ball.j,0,bar);</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;aa<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">/*for(i=0;i&amp;lt;9;i++){
		for(j=0;j&amp;lt;9;j++){
			if (inballArray[i][j]==inballArray[i][j+1]==inballArray[i][j+2]==inballArray[i][j+3]==inballArray[i][j+4]){
				for(k=0;k&amp;lt;4;k++){
					barArray[i][j+k].removeChild(inballArray[i][j+k]);
				}
				score+=5;
			}
		     if (inballArray[i][j]==inballArray[i+1][j+1]==inballArray[i+2][j+2]==inballArray[i+3][j+3]==inballArray[i+4][j+4]){
				for(k=0;k&amp;lt;4;k++){
					barArray[i+k][j+k].removeChild(inballArray[i][j+k]);
				}
				score+=5;
			 }
			 if (inballArray[i][j]==inballArray[i+1][j]==inballArray[i+2][j]==inballArray[i+3][j]==inballArray[i+4][j]){
				for(k=0;k&amp;lt;4;k++){
					barArray[i+k][j].removeChild(inballArray[i+k][j]);
				}
				score+=5
			 }
			if (inballArray[i][j]==inballArray[i+1][j-1]==inballArray[i+2][j-2]==inballArray[i+3][j-3]==inballArray[i-4][j+4]){
				for(k=0;k&amp;lt;4;k++){
					barArray[i+k][j-k].removeChild(inballArray[i+k][j-k]);
				}
				score+=5;
			}
		}
	}*/</span>
&nbsp;
&nbsp;
	randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	randingBall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;bb<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> k:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;k<span style="color: #66cc66;">&amp;</span>lt;ballArray.<span style="color: #0066CC;">length</span>;k++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;cc<span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
	ballArray<span style="color: #66cc66;">&#91;</span>k<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,moveingBall<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-865</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Tue, 04 Nov 2008 20:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-865</guid>
		<description>Hi Michael,

Refactoring a recursive function sounds interesting. We&#039;d love to see an example of how you do that in ActionScript 3.0.

Thanks,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Michael,</p>
<p>Refactoring a recursive function sounds interesting. We&#8217;d love to see an example of how you do that in ActionScript 3.0.</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-861</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Thu, 30 Oct 2008 09:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-861</guid>
		<description>Hi Rolf,

The point you make is certainly valid and it&#039;s probably one I should have included. However, the Fibonacci is used to illustrate how recursion works, and while it is not the most efficient way to generate a Fibonacci sequence, it reveals the nature of the recursive function.

Of course you are quite right, though, that a recursive function is not the best way to generate a Fibonacci value. It&#039;s just a fun way to show recursion.

Thanks for your insightful comment,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Rolf,</p>
<p>The point you make is certainly valid and it&#8217;s probably one I should have included. However, the Fibonacci is used to illustrate how recursion works, and while it is not the most efficient way to generate a Fibonacci sequence, it reveals the nature of the recursive function.</p>
<p>Of course you are quite right, though, that a recursive function is not the best way to generate a Fibonacci value. It&#8217;s just a fun way to show recursion.</p>
<p>Thanks for your insightful comment,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Schmalle</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-857</link>
		<dc:creator>Michael Schmalle</dc:creator>
		<pubDate>Wed, 29 Oct 2008 12:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-857</guid>
		<description>Hi,

I really think this issue boils down to design. When an application is designed from the base up, constraints are found and implemented into the design.

I work with recursive functions quite a bit, Flash 5 -&gt; now. When you run into problems with this is when you are creating a call stack that involves other methods being called indirectly from a recursive method.

IE dispatchEvent() is dangerous in a recursive method.

Once you get experience with the limits of the engine that runs your code (IE Flash Player), you know intuitively where the red line is and don&#039;t even attempt some things (switch from defense to offense).

A lot of the time a recursive function can be refactored into a batch or other related pattern.

Experience gives forward vision and allows an abstract view before any emergency in code throws a stack overflow.

Mike</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I really think this issue boils down to design. When an application is designed from the base up, constraints are found and implemented into the design.</p>
<p>I work with recursive functions quite a bit, Flash 5 -&gt; now. When you run into problems with this is when you are creating a call stack that involves other methods being called indirectly from a recursive method.</p>
<p>IE dispatchEvent() is dangerous in a recursive method.</p>
<p>Once you get experience with the limits of the engine that runs your code (IE Flash Player), you know intuitively where the red line is and don&#8217;t even attempt some things (switch from defense to offense).</p>
<p>A lot of the time a recursive function can be refactored into a batch or other related pattern.</p>
<p>Experience gives forward vision and allows an abstract view before any emergency in code throws a stack overflow.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rolf vreijdenberger</title>
		<link>http://www.as3dp.com/2008/10/23/an-actionscript-30-recursion-excursion/comment-page-1/#comment-852</link>
		<dc:creator>rolf vreijdenberger</dc:creator>
		<pubDate>Tue, 28 Oct 2008 17:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=256#comment-852</guid>
		<description>nice article, but let me point out two things:

the fibonacci example above is the (no diss intended) naive way as it takes exponential time to compute as each recursion needs to calculate the whole sequence of numbers before it -recursively- (in the statement return fibo(r-1) + fibo(r-2); )
not nice ;)
Fibonacci is a case of a problem that can be handled generically with dynamic programming (or memoization), in which you would store the previous calculated output (for fibonacci, this can easily be done in an array to avoid recomputation. Making this change lets the calculation execute in lineair time !!!

Also, as the numbers grow exponentially, values grow very fast.
fibo(45) is actually the largest number that can be represented by a 32 bit integer!</description>
		<content:encoded><![CDATA[<p>nice article, but let me point out two things:</p>
<p>the fibonacci example above is the (no diss intended) naive way as it takes exponential time to compute as each recursion needs to calculate the whole sequence of numbers before it -recursively- (in the statement return fibo(r-1) + fibo(r-2); )<br />
not nice ;)<br />
Fibonacci is a case of a problem that can be handled generically with dynamic programming (or memoization), in which you would store the previous calculated output (for fibonacci, this can easily be done in an array to avoid recomputation. Making this change lets the calculation execute in lineair time !!!</p>
<p>Also, as the numbers grow exponentially, values grow very fast.<br />
fibo(45) is actually the largest number that can be represented by a 32 bit integer!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
