8

Looping Through DataProviders in ActionScript

 3 years ago
source link: http://www.mikechambers.com/blog/2003/02/14/looping-through-dataproviders-in-actionscript/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Looping Through DataProviders in ActionScript

Friday, February 14, 2003

I have received a couple of emails over the past couple of days, asking how to manually loop through a RecordSet / DataProviderClass. It is actually pretty simple and utilizes the getItemAt() and getLength() methods of the DataProviderClass (pseudo interface).

Here is the code:

//rs is a RecordSet object retrieved via FlashRemoting

var len = rs.getLength();
var tmpObj;

for(var i = 0; i < len; i++)
{
	tmpObj = rs.getItemAt(i);
	trace("Field 1 : " + tmpObj.field1);
	trace("Field 2 : " + tmpObj.field2);
}

This will work for all RecordSet and DataProviderClass classes.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK