Knowledge Base


Important! All new questions are usually answered within the next business day.

Drop Down (Tree) Menu V3

(views: 11465)

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: 3585)

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 


User Comments

simple way to center button titles
posted by larkinbox on 2009-09-28

simplest way to center button titles in the menu is to change the button name within the xml file from
"MyButton" to
" MyButton "
if you need more room on either side add more spaces.


Login to post your comment login to post your comment



Back

Knowledge Base Search

Enter keywords below:
Advanced Search
FlashEff 2.0
Create professional flash photo slideshows online

FREE Flash Stuff

Check out these free, fully functional AS3.0 Flash components by Jumpeye:

FlashEff 2.0 Free
(free for non-commercial use)

JC Panorama
(free for non-commercial use)

JC Play List
(fully free)

Basic Menu Pack V3
(free AS3 version)

MCTE V3
(free AS3 version)

JC Player
(free for non-commercial use)

JC Flash Map
(free for non-commercial use)

Flash Bookmarks
(fully free)

ActionScript Bridge AS2-AS3
(fully free)

JS Charts
(free for non-commercial use)

Free Trial Versions

The trial versions do have a major limitation. They will ONLY run into debugger flash player versions, such as the Flash IDE player and the activeX FP used by developers.

Switch from Free Trial version to Full version.

You can switch from Trial to Full versions in a blink of an eye.
See this tutorial in order to find out how.

We accept Google Checkout

Google Checkout Acceptance Mark

Secured by VeriSign