Knowledge Base |
Important! All new questions are usually answered within the next business day.
Drop Down (Tree) Menu V3
(views: 5016)
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
(2007-08-31 - views: 1330)
Q: How can I center the text on my Drop Down Tree Menu V3?
A: In order to center the title texts on the Drop Down (Tree) Menu V3 you have to use this actionscript:
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
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
Login to post your comment
Other questions in this item:
Drop over HTML content Call JavaScript from XML Open menu item pages into target - "_self" Initiate Drop Down Tree Menu V3 through ActionScript Item description from XML Disable-Enable Drop Down (Tree) Menu Displaying the submenu horizontally instead of vertical Navigate through scenes Hand cursor Adding a checkbox to a menu Referencing item's textfield in Drop Down (Tree) Menu V3 Load movies on item select Go to different frames by pressing a menu item Changing Design Different text formats and anti alias Autoexpand on start Adding a separating gap between menu items setXML() generates error message Open menu items upwards Load movies on item select Correct width of the main menuMenu |
|
|
