hey all,
please take a moment to test the code below; creating a kind of interactive rollover menu with some effects. the original code used Math.PI to create a radial menu and i’ve modified it into a vertical menu to suit my needs.
what i can’t manage to do right now are two things:
-
test the movie, and you’ll notice that the spaces between the items (menu elements) are not equal. what causes that or what am i missing here?
-
i’ve set a global onPress function that links to a certain URL. how should i set an onPress function for each menu item individually, so that each item on the menu can be set to link to a different URL?
your help will be much appreciated!
[LEFT]// Inicial Lbot = ["item one", "item two", "item three", "item four", "item five", "item six", "item seven", "item eight", "item nine", "item ten", "item eleven", "item twelve", "item thirteen", "item fourteen", "item fifteen" , "item sixteen"]; Lcolor = ["FF00CC", "FF0099", "CC00FF", "CC3399", "FF00CC", "FF0099", "CC00FF", "CC3399", "FF00CC", "FF0099", "CC00FF", "CC3399", "FF00CC", "FF0099", "CC00FF", "CC3399"];
rad1 = 610;
rad2 = 340;
centx = 180;
centy = 30;
posselx = 300;
possely = 600;
acel = 20;
//
ang = 90/Lbot.length;
angrad = ang/90;
trace(angrad);
for (n=0; n<Lbot.length; n++) {
attachMovie("boton", "b"+n, n);
_root["b"+n].texto = Lbot[n];
_root["b"+n].num = n+1;
_root["b"+n]._x = centx;
_root["b"+n]._y = centy;
_root["c"+n] = new Color(_root["b"+n].fondo);
_root["c"+n].setRGB("0x"+Lcolor[n]);
_root["b"+n].destx = centx+(Math.cos(angrad*n)*rad1);
_root["b"+n].desty = centy+(Math.sin(angrad*n)*rad1);
_root["b"+n].destscale = 100;
_root["b"+n].onRollOver = function() {
this.destscale = 170;
};
_root["b"+n].onRollOut = function() {
this.destscale = 100;
};
_root["b"+n].onPress = function() {
if (this.destx != 300) {
this.destscale = 100;
getURL("http://www.google.com", "_parent");
}
}
};
idmove = setInterval(mover, 10);
function mover() {
for (n=0; n<Lbot.length; n++) {
//dif = _root["b"+n].destx-_root["b"+n]._x;
//_root["b"+n]._x += (dif/acel);
dif = _root["b"+n].desty-_root["b"+n]._y;
_root["b"+n]._y += (dif/acel);
dif = _root["b"+n].destscale-_root["b"+n]._yscale;
_root["b"+n]._yscale += (dif/acel);
_root["b"+n]._xscale = _root["b"+n]._yscale;
//_root["b"+n]._alpha = _root["b"+n]._yscale/2;
}
}[/LEFT]