|
-
Populating a list component from an external .txt file
I need to pull a list of presenters from a .txt file and populate a list component. Here's the code I'm working on, but it's doing nothing:
stop();
loadVariables ("presenters.txt", this);
var n = totalPres;
var i = 1;
// the total nnumber of presenters
presentersListArray = new Array();
while (i < n) {
presentersListArray.push({data:"pres"+n, label:"pres"+n});
// pres+n should equal "pres1", "pres2", etc.
i++;
}
presenters.dataProvider = presentersListArray;
Any help is appreciated. Thanks.
Last edited by alec1241; 03-30-2006 at 03:32 PM.
Scott
-
I got it -- it required a movie clip instance to get it. Here's the code if anyone needs it for reference:
onClipEvent(load) {
loadVariables ("presenters.txt", this);
}
onClipEvent(data) {
presentersListArray = new Array();
for (var ii:Number = 1 ; ii <= totalPres; ii++) {
presentersListArray.push({data:eval("pres"+ii), label:eval("pres"+ii)});
}
_parent.presenters.dataProvider = presentersListArray;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|