Yet another simple problem that is driving me bonkers. I’m writing a menu function from scratch. It’s set up like this:
function buildMenu(menuArray:Array, name:String, depth:Number, x:Number, y:Number, orientation:String):Void {
menu = this.createEmptyMovieClip(name, depth);
for (var i = menuArray.length-1; i>=0; i--) {
menuItem = menu.attachMovie("mc_menu", "menu"+i, i);
menuItem.menu_txt.autoSize = true;
menuItem.menu_txt.text = menuArray*;
x -= (menuItem._width+MENUSPACING);
menuItem._x = x;
menuItem._y = y;
}
}
For the moment, disregard all the extraneous parameters (which don’t have code attached to them), and if you’re wondering why the loop is decrementing, it’s because this is a right justified menu, and it’s being built from right to left. I will change all that in the final code to something a little more logical.
I populate my array with variables, and the function dynamically creates a menu. Each menu item movie clip is embedded in a container that is named by calling function. So far so good.
If I adjust the _x and _y of the container, the entire menu will shift accordingly. If I set visible to false, it disappears, as is to be expected.
However, if I play with the _alpha, nothing happens. I’ve run a trace, I should be referencing the right object, after I change the _alpha to 0, the trace returns an _alpha value of zero. Yet the container and all its attached movie clips remains visible.
So I went up a level, into the for loop, and tried to individually change the _alpha for the attached objects. No dice. _X, _y, and visible all change the menu’s appearance, but _alpha does not.
To be clear, I changed the container properties by sticking “menu._alpha = 0” between the last two braces. Adjusting menu._x and menu._y in the same place produces the expected results.
Where am I going wrong? It doesn’t have anything to do with depth, does it?