Figured it out. Forgot to wrap the cost in a Number()
----------------------------------------
From: "Wally Kolcz" <[email protected]>
Sent: Thursday, September 17, 2009 8:10 AM
To: [email protected]
Subject: [flexcoders] Stupid question: Adding dollars
I must be having a moron-moment. I have dollar amounts in the database (45.32,
34.23, 50.25) and I want to look them and assign them to a Number variable. But
it keeps coming up as NaN or empty. What am I missing here?
[Bindable] public var medTotal:Number = 0;
public function calculateTotal(e:ArrayCollection):void {
for(var i:int = 0; i < e.length; i++){
medTotal += e.getItemAt(i).cost;
}
}