Return to Snippet

Revision: 43228
at March 19, 2011 19:02 by kanuwadhwa


Updated Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
	<mx:Script>
		<![CDATA[
			// 0,1,1,2,3,5,8,13
			public function init():void{
				var a:Number = 0;
				var b:Number = 1;
				txt.text = a.toString();
				txt.text += "\n"+b;
				for(var i:int=2;i<10;i++){
					var c:Number = a+b;
					a = b;
					b = c;
					txt.text += "\n"+c;
				}
			}
		]]>
	</mx:Script>
	<mx:TextArea x="118" y="57" width="553" height="412" id="txt"/>
</mx:Application>

Revision: 43227
at March 19, 2011 17:58 by kanuwadhwa


Initial Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
	<mx:Script>
		<![CDATA[
			// 0,1,1,2,3,5,8,13
			public function init():void{
				var a:Number = 0;
				var b:Number = 1;
				var arr:Array = new Array();
				arr.push(a);
				arr.push(b);
				for(var i=2;i<10;i++){
					var c:Number = a+b;
					arr.push(c);
					a = b;
					b = c;
				}
				for(var j=0;j<arr.length;j++){
					txt.text += "\n"+arr[j];
				}
			}
		]]>
	</mx:Script>
	<mx:TextArea x="118" y="57" width="553" height="412" id="txt"/>
</mx:Application>

Initial URL

                                

Initial Description
Looking forward for the most optimized solution for the same

Initial Title
Fibonacci Series

Initial Tags
actionscript, flash, Flex

Initial Language
ActionScript 3