I figured out what the problem was and will soon be posting the project in the code gallery!!!By the way, that problem happened because I needed to change the change event function and the load layer function to have: if (yearcombo.selectedIndex == 1) { for(var i:uint = 0; i < (2); i++) { var radioBtn:RadioButton = new RadioButton; radioBtn.groupName = "radioBtnGroup"; radioBtn.value = i; if (dynamicLayer.layerInfos.name == "Direct Impact (Million $)") { radioBtn.label = "Direct Impact"; } else if (dynamicLayer.layerInfos.name == "Total Impact (Million $)") {radioBtn.label = "Total Impact"; } else if (dynamicLayer.layerInfos.name == "Total Impact (Jobs)") {radioBtn.label = "Total Impact"; } else if (dynamicLayer.layerInfos.name == "Direct Impact (Jobs)") {radioBtn.label = "Direct Impact"; } else {radioBtn.visible= false; } layerPanel.addChild(radioBtn); radioBtnGroup.selectedValue = 0; dynamicLayer.visibleLayers = new ArrayCollection([2]); myLegend.layers = [dynamicLayer]; myLegend.visible = true; } }INSTEAD OF : if (yearcombo.selectedIndex == 1) { for(var i:uint = 2; i < (dynamicLayer.layerInfos.length); i++) { var radioBtn:RadioButton = new RadioButton; radioBtn.groupName = "radioBtnGroup"; radioBtn.value = i; if (dynamicLayer.layerInfos.name == "Direct Impact (Million $)") { radioBtn.label = "Direct Impact"; } else if (dynamicLayer.layerInfos.name == "Total Impact (Million $)") {radioBtn.label = "Total Impact"; } else if (dynamicLayer.layerInfos.name == "Total Impact (Jobs)") {radioBtn.label = "Total Impact"; } else if (dynamicLayer.layerInfos.name == "Direct Impact (Jobs)") {radioBtn.label = "Direct Impact"; } else {radioBtn.visible= false; } layerPanel.addChild(radioBtn);radioBtnGroup.selectedValue = 2; dynamicLayer.visibleLayers = new ArrayCollection([2]); myLegend.layers = [dynamicLayer]; myLegend.visible = true; } }