-
[RESOLVED] Rotation problem
hello all,
I have an arrow that will point to your cursor, what I want it to do is rotate freely until I mouse over, and then rotate freely if i mouse off of it
here is the free rotation code on the arrow
Code:
arrow.onEnterFrame = function ()
{
arrow._rotation = arrow._rotation + 5;
};
and here is the code on the center of rotaion
Code:
onClipEvent (mouseMove) {
x=this._xmouse;
y=this._ymouse*-1;
angle = Math.atan(y/x)/(Math.PI/180);
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=360}
_root.angletext=angle;
_root.arrow._rotation=angle*-1;
updateAfterEvent();}
please i could really use some help here
-
not exactly sure what you want to have happen, but immediately the mousemove jumps to mind. mousemove happens all the time, whether the mouse is over the element or not. so the mousemove is going to override the enterframe at all times. if you're trying to have the mousemove function only fire when the mouse is over the arrow, try setting the mousemove in a rollover, like so:
PHP Code:
arrow.onRollOver = function(){
this.onMouseMove =function(){
//... whatever you're doing
};
};
arrow.onRollOut = function(){
delete this.onMouseMove;
};
also - don't use clip events. assign handles like i did in the example above, like you did with the enterframe.
-
thanks for the reply it was a huge help;
but now i canot get it to start rotating again after i mouse out here is my code now
Code:
arrow.onEnterFrame = function ()
{
arrow._rotation = arrow._rotation + 5;
};
arrow.onRollOver = function(){
delete arrow.onEnterFrame;
delete this.onRollOut;
this.onMouseMove =function(){
x=Rotate._xmouse;
y=Rotate._ymouse*-1;
angle = Math.atan(y/x)/(Math.PI/180);
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=360}
_root.angletext=angle;
_root.arrow._rotation=angle*-1;
updateAfterEvent();
};
};
arrow.onRollOut = function(){
delete this.onMouseMove;
arrow._rotation = arrow._rotation + 5;
};
ok i think the delete code is wrong but im not sure
Last edited by Tswanny; 08-01-2008 at 12:39 AM.
Almost never counts.
-
at a guess, try this:
PHP Code:
arrow.onEnterFrame = function (){
this._rotation += 5;
};
arrow.onRollOver = function(){
delete this.onEnterFrame;
this.onMouseMove =function(){
x=Rotate._xmouse;
y=Rotate._ymouse*-1;
angle = Math.atan(y/x)/(Math.PI/180);
if(x<0){angle+=180}
if(x>=0&&y<0){angle+=360}
_root.angletext=angle;
this._rotation=angle*-1;
updateAfterEvent();
};
};
arrow.onRollOut = function(){
delete this.onMouseMove;
this.onEnterFrame = function (){
this._rotation += 5;
};
};
-
moagrius your a life saver, thanks!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|