Hi everyone.
I am trying to get a grip of as3 by converting one of my ongoing projects from as2, but it’s really giving me a bit of a headache. I am more of a designer than a developer, so I need help with something that’s probably pretty basic for you guys.
Here is my problem:
I am making a multilanguage company presentation for a company (air-application). The users choose their prefered language from a menu, which then sets up the correct menu, loaded from xml. I do this with a for loop:
for (i = 0; i<xmlData.name.length(); i++) {
var myBtn:bt_mc = new bt_mc();
addChild(myBtn).name = “myBtn” + i;
myBtn.y = 20 + i*(myBtn.height);
myBtn.x = 20;
myBtn.width = 180;
myBtn.buttonMode = true;
myBtn.mouseChildren = false;
myBtn.addEventListener(MouseEvent.MOUSE_DOWN,onpress)
myBtn.addEventListener(MouseEvent.ROLL_OVER,onroll)
myBtn.addEventListener(MouseEvent.ROLL_OUT,onrollout)
var textPath:String = xmlData.name*.text();
myBtn.textfield.text = textPath;
}
So far so good. Menu sets up perfectly.
The problem is that I need to “reset” the menu before running the loop again when I choose another language from the language menu, as it wont replace the buttons allready generated in the lool, as it would with as2 attachMovie.
Any ideas anyone?