I've been struggling with this for hours, so I thought maybe someone else's eye can see it. In my main application, for testing puproses, I have hard coded some XML:
<questions> <question id="1"> <selected>1</selected> <selected>5</selected> </question> <question id="2"> <selected>1</selected> <selected>5</selected> </question> <question id="3"> <selected>1</selected> <selected>5</selected> </question> </questions> This is the dataprovider for a TileList that uses a custom itemRenderer. My itemRenderer has five buttons that correspond to selections 1-5, and these have the ID's aBtn-eBtn. When a user clicks on a button that is selected, I want to remove the selected element that contains the value equivalent to the button they selected. By the same token, if the button is not selected, I want to add a selected node. If no nodes are selected on the question and I add the node from scratch, there is no problem. My code works as expected. However, when the nodes come in with the data object, Flex does not see that there are any nodes with that value. I think it might be a data typing issue, but I have cast the data type to several different types without success. This is my function that _should_ be working: private function changeSelected(theBtn:Button, toggle:Boolean=false):void { selectBtn(theBtn, toggle); var i:int; var selNum:int = theBtn.label.charCodeAt() - 64; trace("typeof selNum " + typeof selNum); var miniXML:XML = XML('<selected>'+selNum+'</selected>') if (!isEditing){ if (data.selected.length()>0){ trace(data.(selected==XML(selNum))); if (data.(selected==selNum).length()<1){ //add the selected node to the data object data.appendChild(miniXML); } else { //remove the selected node from the data object for (i=data.selected.length()-1; i>=0; i--){ if (data.selected[i] == selNum){ delete data.selected [i]; } } } } else { //no children exist at all...add data.appendChild(miniXML); } } else { //editing //delete all previously selected nodes for (i=data.selected.length()-1; i>0; i--){ delete data.selected[i]; } //check to see if this button is "on" //if so, add it back if (theBtn.styleName == 'selectedBtn'){ data.appendChild(miniXML); } } } I am only testing the logic where isEditing is false right now. Thanks in advance for any insight anyone can add. -Amy