I think that since there is no argument to the function, binding does
not know when to execute.

 

Try:

text="{getTotal(cost1.text,cost2.text)}"

 

private function getTotal(cost1:String,cost2:string):Number{

  return (number(cost1) + Number(cost2));

 

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of markflex2007
Sent: Thursday, December 20, 2007 11:41 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] data binding question

 

Hi

I do not know why the data binding doesn't work.Please help me out.

<mx:Script>
<![CDATA[

private function getTotal():Number{

var cost1:Number= Number(cost1.text)
var cost2:Number= Number(cost2.text)


var cost : Number = cost1+cost2;
return cost;

}

]]>
</mx:Script> 


<mx:TextInput id="cost1" />
<mx:TextInput id="cost2" />
<mx:TextInput id="course_total" text="{getTotal()}"/>

Thanks

Mark

 

Reply via email to