Hello Guys,
I am new to Flash AS3 and got stuck at middle of a code where I have to load dynamic menu from XML and remove child(s).
function callServices(callValue:int):void
{
//Loading Service Menus
menuServicesXmlLoader.load(urlServices);
menuServicesXml = new XML(menuServicesXmlLoader.data);
menuServicesXml.ignoreWhitespace = true;
var servicesElements:XMLList = menuServicesXml.page;
var servicesLength:int = servicesElements.length();
if (callValue == 1)
{
var btnServices:FeatureButton;
for (var j:int = 0; j < servicesLength; j++)
{
btnServices = new FeatureButton();
btnServices.btn_name.autoSize = TextFieldAutoSize.CENTER;
btnServices.x = 10 + j * 125 + (stageWidth / 4);
btnServices.y = 63;
btnServices.name = "btnServices" + j;
btnServices.buttonMode = true;
btnServices.mouseChildren = false;
btnServices.addEventListener(MouseEvent.CLICK, onServicesClick);
addChild(btnServices);
var btnServicesTween:Tween = new Tween(btnServices,"x",Strong.easeOut,stageWidth,btnServices.x,5,true);
var btnServicesAlpha:Tween = new Tween(btnServices,"alpha",Strong.easeOut,0,1,5,true);
var serviceElement:XML = servicesElements[j];
var idStringServices:String = serviceElement. @ pageNumber;
var idServicesMenu:int = parseInt(idStringServices);
btnServices.btn_name.text = String(serviceElement. @ pageName).toUpperCase();
pageServicesId[btnServices] = idServicesMenu;
txtContainer.x = 20;
txtContainer.showHideCon.buttonMode = true;
txtContainer.showHideCon.addEventListener(MouseEvent.CLICK, showHideContent);
}
var mcGreenTween:Tween = new Tween(mcGreenBar,"y",Strong.easeOut,mcGreenBar.y,74,2,true);
}
else if (callValue == 0)
{
[COLOR=#ff0000]**removeChild(btnServices);**[/COLOR]
}//var mcGreenTween:Tween = new Tween(mcGreenBar,"y",Strong.easeOut,74,-10,2,true);
}