1 Reply Latest reply on Nov 19, 2011 11:59 PM by ArrowUpRight

    Trying to make a calculator using mxml and actionscript

    JabirKhan701
      I am a fresher for this. Trying to make a calculator application in flex but not sure about what logic to use. Also I am using a textarea field to display what user enters, however if user enters 1 and then enters 2 the number 1 is replaced by number 2. What should I do 
      sso that the textArea field display all numbers that I enter and do not overwrite them? Please help on this. I have pasted the code that I am trying to write.

      <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> <mx:Panel x="754" y="162" width="250" height="337" layout="absolute"> <mx:TextInput x="35" y="-30" id="displaytext"/> <mx:TextInput x="10" y="10" width="210" height="32" id="display"/>  <mx:Script> <![CDATA[ import mx.controls.Alert;  public function myEnterOne():void { var temp:String="One"; var tempOne=int(temp); tempOne=1; display.text=tempOne; }  public function myEnterTwo():void { var temp:String="two"; var tempTwo=int(temp); tempTwo=2; display.text=tempTwo; }  public function myReset():void { display.text=""; }  ]]> </mx:Script>  <mx:Button x="10" y="59" width="64.5" label="1" id="one" click="myEnterOne()"/> <mx:Button x="82" y="59" width="62" label="2" id="two" click="myEnterTwo()"/> <mx:Button x="155" y="59" width="65" label="3" id="three"/> <mx:Button x="10" y="101" width="64.5" label="4" id="four"/> <mx:Button x="82.5" y="101" width="64.5" label="5" id="five"/> <mx:Button x="155" y="101" width="65" label="6" id="six"/> <mx:Button x="10" y="142" width="64.5" label="7" id="seven"/> <mx:Button x="82.5" y="142" width="64.5" label="8" id="eight"/> <mx:Button x="155" y="142" width="65" label="9" id="nine"/> <mx:Button x="10" y="181" width="64.5" label="+"/> <mx:Button x="82.5" y="181" width="64.5" label="0"/> <mx:Button x="155" y="181" width="65" label="-"/> <mx:Button x="10" y="226" width="64.5" label="/"/> <mx:Button x="82.5" y="226" width="64.5" label="%"/> <mx:Button x="155" y="226" width="65" label="*"/> <mx:Button x="10" y="265" label="RESET" click="myReset()"/> <mx:Button x="82.5" y="265" label="ENTER" click="init()"/> <mx:Button x="155" y="265" label="Button"/> </mx:Panel> </mx:Application>