SOLVED: Scroll to the bottom
Ok - let me start off with my code:
private function dropboxFilling():void {
//
var matchFound:Boolean;
for(var i:uint = 0; i < ssMC.numChildren; i++) {
//Test for a combobox
if(ssMC.getChildAt(i) is ComboBox) {
//
var thisCB:ComboBox = ssMC.getChildAt(i) as ComboBox;
[COLOR=Blue]thisCB.addItem({label:"All"});[/COLOR]
for each(var node:XML in database.*){
//trace(ssMC.getChildAt(i).name, node.localName());
for each(var subNode:XML in node.*) {
if(ssMC.getChildAt(i).name.substring(3,ssMC.getChildAt(i).name.length).toLowerCase() == subNode.localName()) {
for(var j:uint = 0; j < thisCB.length; j++) {
if(thisCB.getItemAt(j) == subNode.toString()) {
matchFound = true;
break;
}
//If no match is found, then add the item
[U]**if(!matchFound) thisCB.addItem({label:subNode.toString()});**[/U]
//Reset flag
matchFound = false;
}
}
}
}
}
}
}
Notice the line in bold/underlined… this is the line that makes the system freak out. It gives me this error message:
“Error #1502: A script has executed for longer than the default timeout period of 15 seconds.”
Now notice the line in blue. It is pretty much the same thing and it works just fine! I’ve tried to change the line that’s causing trouble to add an item like “1”, but that doesn’t work either.
Any help would be MUCH appreciated!
SOLUTION:
I had some of my ordering wrong:
private function populateDropBoxes():void {
//
var matchFound:Boolean;
for(var i:uint = 0; i < ssMC.numChildren; i++) {
//Test for a combobox
if(ssMC.getChildAt(i) is ComboBox) {
//
var thisCB:ComboBox = ssMC.getChildAt(i) as ComboBox;
thisCB.addItem({label:"All"});
for each(var node:XML in database.*){
for each(var subNode:XML in node.*) {
if(ssMC.getChildAt(i).name.substring(3,ssMC.getChildAt(i).name.length).toLowerCase() == subNode.localName()) {
//Find duplicates
for(var j:uint = 0; j < thisCB.length; j++) {
if(thisCB.getItemAt(j).label == subNode.toString()) {
matchFound = true;
break;
}
}
//If no match is found, then add the item
if(!matchFound) {
thisCB.addItem({label:subNode.toString()});
}
//Reset flag
matchFound = false;
}
}
}
}
}
}