4 Replies Latest reply on Mar 12, 2010 8:17 AM by jimmyoneshot

    Performing Calculations in Flex

    jimmyoneshot Level 1

      I have a small app in which I want to calculate prices. What I want to do is add together all of the values in the 3 top label's text fields and then times that by the value currently selected value in the quanity selector once a button is clicked. I'm not sure on the operators to use so just took a guess but this doesn't work:-

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

       

       

      <mx:Label id="priceAddon1Label" text="02.99"/>

       

      <mx:Label id="priceAddon2Label" text="04.99"/>

       

      <mx:Label id="priceAddon3Label" text="06.99"/>

       

       

      <mx:NumericStepper id="quantitySelector"/>

       

       

      <mx:Button label="Calculate" click="totalPrice.text=priceAddon1Label.text + priceAddon2Label.text + priceAddon3Label.text * quantitySelector.value"/>

       

       

       

       

       

      <mx:Label id="totalPrice"/>

       

      </mx:Application>

       

      Can anyone suggest anything to get this to work? Thanks for any suggestions