Good evening Kirupa friends:
Im creating a menu of 10 items and I want to arrange their x and y positions without writing too many lines of code… so this is what i got so far.
//these are my menu items that are reference by their ids
menuItems = new Array(menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9, menu10);
//this is the function that position the menu items the first time the app launches
private function arrange():void
{
var intY:int = 117;
var intX:int = 35;
var i:int = 0;
var menuLength:int = menuItems.length;
for (i; i < menuLength; i++)
{
menuItems*.y = intY;
menuItems*.x = intX;
intY += 49;
}
}
all of that above is good…
so what i want to do now is lets say i select menu item 2… if that’s the case, i want to move the other items down x amount of pixels by its y position…and keep menu item 1 in its default place… i hope this makes sense… is there a short way to do this to avoid repetitive coding?
thanks!