/ Published in: ActionScript 3

Looking forward for more optimized solution for the same
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ var num:Number = 10; public function init():void{ factor(num); txt.text = factor(num).toString(); } public function factor(num:Number):Number{ var mul:Number = 1; for(var i=2;i<=num;i++){ mul *= i; txt.text += "\n >>"+mul; } return mul; } ]]> </mx:Script> <mx:TextArea x="118" y="57" width="553" height="412" id="txt"/> </mx:Application>
Comments
