I figured out the solution!
If the items in your xml file are more or less than "5" change the number to suit.Code:var req: URLRequest = new URLRequest("menuDef.xml"); var loader:URLLoader = new URLLoader(req); var i:int var myXML:XML = new XML(); loader.load(req); loader.addEventListener(Event.COMPLETE,dataLoaded); //Button code function dataLoaded (event: Event){ myXML = new XML(loader.data); for (i = 0; i < 5; i++){ var j:int = i+ 1; /**3 is the line in the xml the labels start from. (i) starts counting from the 4th line until the end specified above.**/ this["btnMenu"+ j].btText.text = myXML.child(3).child(i); } }




Reply With Quote