OK - here's more info. I'm passing the returned array as the dataprovider for a list (passed as "dataObject"):
<mx:List id="listDisplay" rowCount="{listDisplay.dataProvider.length}" labelFunction="myLabelFunction" dataProvider="{dataObject}" rowHeight="16" selectable="false" styleName="dgTextStyle" width="100%"/> The labelFunction is: function myLabelFunction(item):String { return item.label + ": " + item.data; } Does that help? I thought the string conversion in the function would do the trick, because the labelFunction is looking for strings, but that still gives me a NaN. - Tom At 10:11 AM 4/17/2005, you wrote: >Hi, > >Everything in function seems to be right, I feel something is wrong >somewhere else..... > >Can you post the code, how you are calling this function. > >To isolate the problem, just call this function and show results in alert. > >e.g. > >alert(getPercentages(80,20,10000)[0].data) > > >-abdul > > >-----Original Message----- >From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] >Sent: Sunday, April 17, 2005 5:40 PM >To: flexcoders@yahoogroups.com >Subject: [flexcoders] Simple arithmetic > > >I'm trying to pass three numbers to a function and have it return an array >containing two numbers that will be used as the dataprovider for a list. >The list uses a labelFunction to display items in the form: > >"label": "data" >"label": "data" > >for example: > >Salary: $80,000 >Bonus: $20,000 > >Here's the latest thing I tried (doesn't work, but shows what I'm shooting >for): > >function getPercentages(varX:Number,varY:Number,varZ:Number) >{ > varX= (varX/100)*varZ; > varY= (varY/100)*varZ; > var newSalary = varX.toString(); > var newBonus = varY.toString(); > var newFigures = [ > {label:"Salary",data:newSalary}, > {label:"Bonus",data:newBonus} > ]; > return newFigures; >} > >Feeding the numbers > >varX = 80 >varY = 20 >varZ = 100,000 > >should yield this list: > >Salary: $80,000 >Bonus: $20,000 > >Instead, I get: > >Salary: NaN >Bonus: NaN > >Assuming I've provided enough information, can anyone see what's wrong? > >- Tom > > > > > > > >Yahoo! Groups Links > > > > > > > > > >---------- >Yahoo! Groups Links > * To visit your group on the web, go to: > * > <http://groups.yahoo.com/group/flexcoders/>http://groups.yahoo.com/group/flexcoders/ > > > * > * To unsubscribe from this group, send an email to: > * > <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED] > > * > * Your use of Yahoo! Groups is subject to the > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/