I thought that too but when I tried that, flex had a problem with var 
n:int = ciData.length; instead it gives me a 1069 error.
let me mention that before I tried to break the code apart it did 
work.

Perhaps a little more explaination.... 
I am trying to move the dp:Array() that was in the mx:Script tag to 
an exteternal xml file and in doing so the Array() changed to an 
ArrayCollection() and I'm thinking it needs to be handled differently?
is this true?

Dave

--- In flexcoders@yahoogroups.com, "Haykel BEN JEMIA" <[EMAIL PROTECTED]> 
wrote:
>
> I think you should be using ciData instead of dp in these function. 
It's the
> property that seems to hold the data returned by the service.
> 
> On Sun, Sep 21, 2008 at 7:43 PM, dmschenk1 <[EMAIL PROTECTED]> wrote:
> 
> >   I have a 1119 error that is giving me fits and I'm sure its 
probably
> > something simple but I've been trying for days with no luck.
> >
> > Would someone please take a look at this code and help me figure 
out
> > what I'm doing wrong here?
> > The problem is in "dp.length" at line 18 of the "AverageFunction" 
and
> > also in line 29 of the "TotalFunction" but being new to 
programing I
> > don't really understand how to interpolate the error.
> >
> > -------------------------
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > xmlns:scripts="scripts.*"
> > initialize="dp.send()" >
> >
> > <mx:Script>
> > <![CDATA[
> > import mx.collections.ArrayCollection;
> > import mx.rpc.events.ResultEvent;
> >
> > [Bindable]
> > private var ciData:ArrayCollection = new ArrayCollection();
> > private function ciResult(event:ResultEvent):void{
> > ciData = event.result.Credit.Creditor;
> > }
> >
> > public function AverageFunction(col:DataGridColumn):String {
> > var n:int = dp.length;
> > var avg:Number = 0;
> > for (var i:int = 0; i < n; i++)
> > {
> > avg += dp[i][col.dataField];
> > }
> > avg /= n;
> > return "Avg: " + avg.toFixed(1) +"%";
> > }
> >
> > public function TotalFunction(col:DataGridColumn):String {
> > var t:int = dp.length;
> > var tot:Number = 0;
> > for (var i:int = 0; i < t; i++)
> > {
> > tot += dp[i][col.dataField];
> > }
> > return "Total: $" +tot.toFixed(2);
> > }
> >
> > ]]>
> > </mx:Script>
> >
> > <mx:HTTPService id="dp" url="data/creditInfo.xml"
> > result="ciResult(event)" />
> >
> > <scripts:FooterDataGrid id="dGrid" initialize="dGrid.dataProvider 
=
> > dp" width="550" paddingTop="0" paddingBottom="0"
> > verticalAlign="middle">
> >
> > <scripts:columns>
> >
> > <scripts:FooterDataGridColumn headerText="" 
dataField="creditorName" >
> >
> > <mx:DataGridColumn headerText="Name" dataField="creditorName"
> > editable="true"/>
> >
> > </scripts:FooterDataGridColumn>
> >
> > <scripts:FooterDataGridColumn headerText="Interest Rate"
> > dataField="interestRate" >
> >
> > <mx:DataGridColumn labelFunction="AverageFunction"
> > dataField="interestRate" editable="true" />
> >
> > </scripts:FooterDataGridColumn>
> >
> > <scripts:FooterDataGridColumn headerText="Balacnce"
> > dataField="balanceOwed" >
> >
> > <mx:DataGridColumn labelFunction="TotalFunction"
> > dataField="balanceOwed" editable="true" />
> >
> > </scripts:FooterDataGridColumn>
> >
> > <scripts:FooterDataGridColumn headerText="Monthly Payment"
> > dataField="monthlyPayment" >
> >
> > <mx:DataGridColumn labelFunction="TotalFunction"
> > dataField="monthlyPayment" editable="true" />
> > </scripts:FooterDataGridColumn>
> > </scripts:columns>
> > </scripts:FooterDataGrid>
> >
> > </mx:Application>
> > --------------------------------
> >
> > Thanks
> > Dave
> >
> >  
> >
> 
> 
> 
> -- 
> Haykel Ben Jemia
> 
> Allmas
> Web & RIA Development
> http://www.allmas-tn.com
>


Reply via email to