Actually this is the entire code with 2 scenarios. but needs a liltle tweaking 
to make it better. by better i mean, the balance starts off getting computed 
the moment either the amountPaid textinput or manFees textinput is being fed in 
a figure. thanks 

 <?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)))
 } 
 
 if (Number(amountPaid.text) < Number(currentPaid.text) && Number(manFees.text) 
> Number(currentFees.text)){
 //amt = Number(currentBal.text) + ((Number(currentPaid.text) - 
Number(amountPaid.text)) + (Number(manFees.text) - Number(currentFees.text)))
 
 amt = (Number(currentBal.text) + (Number(currentPaid.text) - 
Number(amountPaid.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