Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.setRange() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.setRange(startValues,endValues)
startValues An array of key values of the properties of the first transfer object in the range.
endValues An array of key values of the properties of the last transfer object in the range.
Nothing.
Method; sets the end points for the current iterator. The end points define a range in which the iterator operates. This is only valid if a valid sort has been set for the current iterator by means of DataSet.addSort().
Setting a range for the current iterator is more efficient than using a filter function if you want a grouping of values (see DataSet.filterFunc).
The following example selects a range of students and traces each of their names to the Output panel:
my_ds.addItem({name:"Billy", id:104, gradeLevel:4});
my_ds.addItem({name:"Bobby", id:105, gradeLevel:4});
my_ds.addItem({name:"Carrie", id:106, gradeLevel:4});
my_ds.addItem({name:"Cathy", id:110, gradeLevel:4});
my_ds.addItem({name:"Mally", id:112, gradeLevel:3});
my_ds.addSort("name_id",["name", "id"]);
my_ds.setRange(["Bobby", 105],["Cathy", 110]);
while (my_ds.hasNext()) {
trace(my_ds.name); // Bobby..Cathy
my_ds.next();
}
DataSet.addSort(), DataSet.hasNext(), DataSet.next(), DataSet.removeRange(), DataSet.removeSort()
Flash CS3