I have re-done a few things trying to follow what has been said.
Below is the code to make the object, put it in an array (needed for
another part of the project) and put it in and ArrayCollection. the
class (School), array (Schools), and ArrayCollection (SchoolsAC) are
all public and Bindable.
private function makeSchoolObj(schoollist:XML):void {
try {
trace("in makeSchoolObj");
var id:int;
for (i = 1; i < 4; i++) {
id = int(schoollist.school[i].id)-60000;
Schools[id]=new School(String(id));
Schools[id].name = schoollist.school[i].name;
SchoolsAC.addItem(Schools[id]);
}
for (var i:int = 0; i < SchoolsAC.length; i++){
trace(SchoolsAC.getItemAt(i).name);
}
// trace results as expected:
Minnesota State College - Southeast Technical - Red Wing
Metropolitan State University
DCTC - Rosemont
<mx:DataGrid x="48" y="10" width="576" dataProvider="SchoolsAC">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name"/>
</mx:columns>
</mx:DataGrid>
Now I get Error #1065: Variable SchoolsAC is not defined.
I am sure I am missing something obvious and am open to all
suggestions.
TIA
Sandy