
Welcome Guest
|
#1
|
|||
|
|||
|
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 |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |




