LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-03-2004, 03:13 PM
tommie20 tommie20 is offline
Registered User
 
Join Date: May 2004
Location: Holland
Posts: 1
Rep Power: 0
tommie20 is on a distinguished road
Positioning xml generated menu

Hey peeps

I want to position the buttons in rows of 4 the buttons are about 30 pixels wide but with the action script I have now everything is generated underneath each other

the code



Actionscript:
onClipEvent(load){
        
        // || Menu Properties ----------------------------
        
        // space between top level menu items
        var menuSpacer = 1;
        // space between sub menu elements
        var subSpacer = 1;
        // the speed the menu items animate. a higher value equals a slower speed
        var menuSpeed = 2;
        // when a menu item is within this value of it's target postion, the animation will be stopped
        var menuTolerance = 1;
        // the time in milliseconds that the sub menus opening animations are staggered
        var subDelay = 100;
        
        // -- Execute Action -------------------------------
        
        function executeAction(arg){
                // do load movie here:
                loadMovieNum(arg,2);
                //display = arg;
        }
        
        // contains the string of the current sub menu or null if no sub menu is open
        var curItem = null;
        // pointer to the menu object structure
        var menuObj = _root.menuObj;
        // enterframe assignment variable
        var onenterframe = null;
        
        // || On Load Actions ----------------------------
        
        
        // -- Build top level menu -------------------------
        
        d = 0;
        for(i in menuObj){
                // attach menu item
                this.attachMovie('item',i,d);
                k = this[i];
                // position menu item
                k._x = 0;
                k._y = (k._height+menuSpacer)*d;
                // set the properties of the menu item
                k.name = menuObj[i].name;
                k.arg = menuObj[i].arg;
                k.sub = menuObj[i].sub;
                k.basey = k._y;
                // hide icon if there is no sub menu for this menu item
                if(k.sub == false){
                        k.icon._visible = false;
                }
                d++;
        }
        
        // -- Top level menu function -----------------------
        
        // selectItem() is called when a top level menu item is released
        // this function will either toggle a sub menu or execute an action
        
        function selectItem(item){
                if(this[item].arg != null && curItem != item){ // if an action is specified and this menu item isn't active
                        // execute a top level action action
                        executeAction(this[item].arg, this[item].jlayer);
                }
                if(this[item].sub == false || curItem == item){
                        // remove current sub menu
                        curItem = null;
                        removeSub();
                }else{
                        // build selected sub menu
                        curItem = item;
                        buildSub(item);
                }
        }
        
        // -- Animate top level menu items ------------------
        
        function menuAnimation(){
                var i, j, k=true;
                for(i in menuObj){
                        j = this[i];
                        j._y += (j.target-j._y)/menuSpeed;
                        if(Math.abs(j.target-j._y)>menuTolerance){
                                k = false;
                        }else{
                                j._y = j.target;
                        }
                }
                if(k){
                        onenterframe = null;
                        if(curItem != null){
                                activateSub();
                        }
                }
        }
        onClipEvent(enterFrame){
                onenterframe();
        }

thnx
__________________
wddppp
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Scrolling List gusbus21 Flash CS4 0 11-15-2009 10:22 PM
xml menu in flash bac0417 ActionScript 3.0 0 08-21-2009 08:35 PM
general question about xml menu architecture fhickler Flash CS3 / Flash 9 13 01-29-2009 10:04 PM
XML MENU (condition for "next line" transition) DuTraveller Flash MX ActionScript 11 01-15-2004 06:01 PM
Flash - XML menu (macromedia FlashMX dropdown menu help) Flash_kid76 XML & Sockets 1 04-09-2003 10:04 AM




All times are GMT. The time now is 05:59 AM.