Adding a mouse event into a script (rotator menu)
I am creating a rotating menu. This is the code in each one of the 4 buttons inside the menu.
PHP Code:
onClipEvent(load){
y=0;
speedR=5;
radius=100;
xcenter=393/2;
ycenter=325/2;
zcenter=100;
angle=0;
fl=150;
}
onClipEvent(enterFrame){
_x=Math.cos(angle*Math.PI/180)*radius+xcenter;
_y=y+ycenter;
z=Math.sin(angle*Math.PI/180)*radius+zcenter;
scale=fl/(fl+z);
_xscale= _yscale = scale*100;
angle+=speedR;
if(angle>359){
angle-=360;
}
}
How can I add a mouse event in which slows down the speed of the button or stop the menu of moving??
Thank you
Maybe you can adapt this to what you are trying to do...
On main timeline...
Code:
var isOver = false;
On clips...
Code:
onClipEvent (load) {
y = 0;
speedR = 5;
radius = 100;
xcenter = 393 / 2;
ycenter = 325 / 2;
zcenter = 100;
angle = 0;
fl = 150;
this.onRollOver = function() {
_root.isOver = true;
};
this.onRollOut = function() {
_root.isOver = false;
};
}
onClipEvent (enterFrame) {
_x = Math.cos(angle * Math.PI / 180) * radius + xcenter;
_y = y + ycenter;
z = Math.sin(angle * Math.PI / 180) * radius + zcenter;
scale = fl / (fl + z);
_xscale = _yscale = scale * 100;
angle += ((_root.isOver) ? 0.5 : speedR);
if (angle > 359) {
angle -= 360;
}
}