AS2-Help with rotating circular menu
Hi there, with help from a few tutorials, I've made a menu with 5 buttons that rotate around a central Clip. So far so good.
Except I need to add an arrow that will point toward the center whenever a button is activated. Kind of like a tooltip with a compass in it... Much like picture below:
http://idisk.mac.com/animationap//Public/mandat.png
http://idisk.mac.com/animationap//Public/mandat2.png
Everything is AS2 with no animation on the timeline. I've been stuck on this for days :crazy: Firstly, I'm having a hard time to get this arrow mc to rotate on a SMALLER trajectory than my five buttons. Secondly, I cannot get the arrow mc to rotate on itself 360° while it goes around it's trajectory. And finally, I'm not sure if I need 5 arrow mc (one for each button), of if a single mc could be triggered to appear next to whichever button is being called for.
So I would really appreciate any suggestions as to how I might fix my code (AS2) and get the lightning to position itself where it must be. Thanks!
Actionscript Code:
var rotX:Number = 290;
var rotY:Number = 140;
var Centre:Number = Stage.height/2;
var vitesse:Number = 0.1;
var sceneW:Number =Stage.width;
var sceneH:Number = Stage.height;
var nbI:Number=5;
var angle:Number=1;
var i:Number;
var lightning:MovieClip = this.attachMovie("arrow", "arrow", 1000);
arrow._alpha = 0;
var videostopped:Boolean = false;
for(i=0;i<nbI;i++)
{
//_____________________
var button:MovieClip = this.attachMovie('Icone'+i,'Ic'+i,i);
//_____________________
button.onRelease= onRelease;
button.onRollOut = onRollOut;
button.onRollOver = onRollOver;
}
function onRollOver():Void {
lightning._alpha = 100;
videostopped = true;
}
function onRollOut():Void {
lightning._alpha = 0;
videostopped = false;
}
onEnterFrame=function(){
if (!videostopped) {
//_____
if (angle > (2*Math.PI))
{
angle = 0;
}else{
for(i=0; i<nbI; i++){
//_____________________angle on x axis
this['Ic'+i]._x=rotX*Math.cos(angle+2*Math.PI*i/nbI)+sceneW/2;
//_____________________angle on y axis
this['Ic'+i]._y=rotY*Math.sin(angle+2*Math.PI*i/nbI)+sceneH/2;
//_____________________Speed
angle=angle+(sceneW/180)/sceneH*vitesse;
}
}
}
}