Flex XMLList Error #1086: appendChild 方法只能用于包含单一项目的列表
?Flex的 XMLList 对象,要对其添加xml,想到了用appendChild()方法,但每次以调用该方法就会出错,错误信息如下:
?Error #1086: appendChild 方法只能用于包含单一项目的列表.
查API发现XMLList根本不存在次方法,那自动提示怎么能显示呢??网上搜了一圈发现了这篇文章:
[Bindable]private var hideFlagList:XMLList;private function changeFlag():void{?var hideXml:XML = <values></values>;?for(var i:int=0;i<unitList.length();i++ )?{??var objXml:XML = unitList[i];??if(objXml.choose[0] == "false")??{???hideXml.appendChild(objXml);??}else if(objXml.choose[0] == "true" )??{???if( dg.dataProvider == unitList)???continue;???//将要隐藏的属性给unitList赋值//???for(var j:int =0;j<unitList.length();j++ )//???{//????if(objXml.order[0] == unitList[i].order[0])//????{//?????objXml.divItemType[0] = unitList[i].divItemType[0];//?????objXml.choose[0] = unitList[i].choose[0];//????????//????}//???}??}??????}?????hideFlagList = hideXml.objValues;}??
?
并且,xml里面的数据也是以对象形式出现的.