Knowledge Base |
Drop Down (Tree) Menu V3
Drop Down Menu V3 and Drop Down Tree Menu V3 are xml flash accordion menus featuring customized states, customized transitions and tweens. Here are all known issues for Drop Down Menu V3 and Drop Down Tree Menu V3, they should be similar, since basically it is the same component. If you have any questions that you think we should discuss here please let us know.
Centering the titles on the Drop Down (Tree) Menu V3
var listener = new Object();
listener.onDrawComplete = function (evtObj){
//call recurent function for the first menu.
parseMenu(dropDownMenu.subMenus)
}
//this is a function which parse each item .
function parseMenu(arg){
//arg = menu reference
//get the length of the menu items array
var len = arg.itemsMc.length
//go on each menu item
for (var i =0;i<len;i++){
//check if this menu item will open another submenu . If yes we will check that submenu
if (arg.itemsMc[i].myMenu!=undefined){
parseMenu(arg.itemsMc[i].myMenu);
}
//set AutoSize to false for this textField
arg.itemsMc[i].myText.autoSize = false
//set new Width for this textFiels . The width will depend of the width of the background clip.
arg.itemsMc[i].myText._width =arg.itemsMc[i].false_upStateMc._width- arg.itemsMc[i].myText._x*2;
//create new TextFormat for this TextField
var newTextFormat = new TextFormat();
//Set Align property
newTextFormat.align = "center";
//Apply textFormat to textField
arg.itemsMc[i].myText.setTextFormat(newTextFormat);
}
}
//add listener to the menu
//dropDownMenu is the instance name of your DropDownMenu component on stage.
this.dropDownMenu.addEventListener("onDrawComplete",listener)
You can also download the attached archive:
Files: DropDownMenuCenteredText.zip