Hello Guys, i have a small problem. i have this form where i calculated updated 
balance based on data already available and data from 2 text inputs. the result 
is correct but i would like that when someone types in one textinput the 
balance is computed and then further if someone inputs a figure in the second 
text input. below is the code i got as of now. It needs improvement.
 

 <?xml version="1.0" encoding="utf-8"?>
 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
 layout="vertical"
 horizontalAlign="center"
 verticalAlign="top">
 
 <mx:Script>
 <![CDATA[
 
 private function calBalance(event:Event):void
 {
 var amt:Number=new Number;
 
 if (Number(amountPaid.text) > Number(currentPaid.text) && Number(manFees.text) 
> Number(currentFees.text)){
 amt = Number(currentBal.text) - ((Number(amountPaid.text) - 
Number(currentPaid.text)) + (Number(manFees.text) - Number(currentFees.text)))
 } 
 
 balance.text=amt.toFixed(0);
 }
 
 ]]>
 </mx:Script>
 
 <mx:Panel height="400"
  layout="vertical">
 

 <mx:HBox>
 <mx:Label text="Payment:"
  width="113"/>
 <mx:TextInput id="amountPaid" change="calBalance(event)"/>
 <mx:Label text="Management Fees:"/>
 <mx:TextInput id="manFees" change="calBalance(event)"/>
 </mx:HBox>
 

 <mx:HRule width="100%"/>
 <mx:HBox>
 <mx:Label text="Current Balance:"
  width="126"/>
 <mx:Text text="515000"
 id="currentBal"/>
 </mx:HBox>
 <mx:HBox>
 <mx:Label text="Amount Already Paid:"
  width="126"/>
 <mx:Text text="500000"
 id="currentPaid"/>
 </mx:HBox>
 <mx:HBox>
 <mx:Label text="Fees Paid:"
  width="126"/>
 <mx:Text text="0"
 id="currentFees"/>
 </mx:HBox>
 <mx:HBox>
 <mx:Label text="updated Balance:"
  width="126"/>
 <mx:Text id="balance"/>
 </mx:HBox>
 </mx:Panel>
 

 
 </mx:Application>
 

 

  • [flexcoders] ... stinas...@yahoo.com [flexcoders]
    • [flexcod... stinas...@yahoo.com [flexcoders]
      • [fle... stinas...@yahoo.com [flexcoders]
    • Re: [fle... Abhinay Dronamraju abhinay.dronamr...@yahoo.com [flexcoders]
      • Re: ... stinas...@yahoo.com [flexcoders]
        • ... Alex Harui aha...@adobe.com [flexcoders]

Reply via email to