Mega Code Archive

 
Categories / Flex / Components
 

Sum value from two TextInput in Button action

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">     <mx:Script>                  function mySum(number1:Number, number2:Number):void         {                  var sum:int = number1 + number2;              myLabel.text = "The sum of the numbers is:" + " " + sum;         }            </mx:Script>     <mx:VBox x="213" y="110" height="290" width="218">         <mx:TextInput id="inputNumber1" width="50" />         <mx:TextInput id="inputNumber2" width="50" />         <mx:Label id="myLabel" />         <mx:Button label="Add the numbers" click="mySum(2, 3)" />     </mx:VBox> </mx:Application>