Now, anytime the mainArray is change, I want to rebuid the dropdown list. So, I proceed to clear the existing array, and then find all non-blank [0] column values and add them to the parentArray.
rebuildDropdown () {
parentArray.length = 0;
for (var i = 0; i < 6; ++i) {
if (mainArray[i][0] <> "") {
parentArray.push(mainArray[i][0]);
trace("mainArray val: "+mainArray[i][0]);
}
}
}
But, even with values in the mainArray, the dropdown only ever lists the last var pushed to the parentArray - not all three as should be in this case.
The trace shows all three values correctly. Any ideas? :0
hrrmm....it seems that the parentArray.addItem isnt doing anything. Doing a trace on the Array indexes shows it all undefined.
Code:
parentArray.removeAll();
tempx = 0;
for (var i = 0; i < 6; ++i) {
if (mainArray[i][0] != "") {
parentArray.additem(mainArray[i][0]);
trace("mainArray value: "+mainArray[i][0]); <-- all correct
trace("parentArray insert: "+parentArray[tempx]); <--all undefined
++tempx;
}
}
Ok, haha...this is retarded. But, the dropdown was being populated correctly with my original code. Some how, the dropdown's rowCount got set to 1 - so only the last item was shown and the scroll bar was pretty much removed which lead me to believe there was only one item. <smaaaaaaaack!>
And, you need to specify the label and data when using additem for it to work. It works fine when use I this: