I’d imagine that if you’re seeing numerous calls to length interspersed with getItemAt that we simply didn’t do an optimal loop.

 

for (var idx = 0; idx < dataProvider.length; ++idx)

{

  var item = getItemAt(idx);

}

 

get length() is going to be called on every iteration of the loop.  It’d obviously be more efficient to store length in a local variable and just use that, but maybe we didn’t somewhere.

 

Matt


From: [email protected] [mailto:[email protected]] On Behalf Of rbelknap
Sent: Friday, June 03, 2005 3:24 PM
To: [email protected]
Subject: [flexcoders] Contract between DataProvider and ComboBox or DataGrid

 

Hi,

I'm struggling to figure out the implied contract between
DataProviders and their users like ComboBox or DataGrid. When either
a ComboBox or DataGrid first uses a DataProvider they seem to make
numerous calls to:

   public function get length():Number

and

   function getItemAt(index : Number)

but it isn't obvious what the logic is behind these calls. 

I was expecting to see a call to get the length followed by a series
of calls to getItemAt starting at index 0 and running to index length-
1, but that's not what I see.

Has anyone run across any good discussions of DataProviders and their
users?

Thanks,

Randy






Yahoo! Groups Links

Reply via email to