Spyder
11-20-2004, 09:03 PM
I'm trying to create a fairly simple effect but am getting confused with FlashMX 2004 pro's version of actionScript.
I have created a triangle within a circle and have converted it to a mc. When the user rolls over the right half of the circle, the triangle (and accompanying circle) needs to rotate 90 degrees cw. If the user rolls over the left half, the triangle needs to rotate 90 degrees (from original position) ccw.
I could easily set up two moveClips, one that turns to the right and one that turns to the left. BUT, I don't want it that cheap. If the user has rolled over the right 1/2 and then rolls over the left 1/2, the triangle should rotate 180 degrees ccw (and vice-versa).
Currently I'm using two buttons that control the triangle_mc. Here is the code that I've attached to the right-half button:
on(rollOver) {
//disable handCursor to eliminate 'button' feel
this.useHandCursor = false;
while (spinTri_mc._rotation < 90){
updateClipEvent(); //<--not working
spinTri_mc._rotation += 2;
}
}
//when user mouseLeaves the button, triangle should reset to 0 degrees, not //working :(
on(rollOut) {
while (spinTri_mc._rotation > 0) {
spinTri_mc._rotation -= 2;
updateClipEvent();
}
}
The rollOver function does work, but makes the triangle 'jump' from 0 degrees to 90 degrees. The rotation effect is not seen.
Is there a better way to approach this? I mean, can you not simply detect the mouse entering the movieClip and have the movieClip react to that?
Please advise, I've read many pages of the FlashMX Bible, many hours spent wasting my time through the feeble 'Help' files associated with Flash MX 2004 pro and more hours trying to find the answer online.
I appreciate any suggestions and conceptual ideas.
TIA,
Spyder
I have created a triangle within a circle and have converted it to a mc. When the user rolls over the right half of the circle, the triangle (and accompanying circle) needs to rotate 90 degrees cw. If the user rolls over the left half, the triangle needs to rotate 90 degrees (from original position) ccw.
I could easily set up two moveClips, one that turns to the right and one that turns to the left. BUT, I don't want it that cheap. If the user has rolled over the right 1/2 and then rolls over the left 1/2, the triangle should rotate 180 degrees ccw (and vice-versa).
Currently I'm using two buttons that control the triangle_mc. Here is the code that I've attached to the right-half button:
on(rollOver) {
//disable handCursor to eliminate 'button' feel
this.useHandCursor = false;
while (spinTri_mc._rotation < 90){
updateClipEvent(); //<--not working
spinTri_mc._rotation += 2;
}
}
//when user mouseLeaves the button, triangle should reset to 0 degrees, not //working :(
on(rollOut) {
while (spinTri_mc._rotation > 0) {
spinTri_mc._rotation -= 2;
updateClipEvent();
}
}
The rollOver function does work, but makes the triangle 'jump' from 0 degrees to 90 degrees. The rotation effect is not seen.
Is there a better way to approach this? I mean, can you not simply detect the mouse entering the movieClip and have the movieClip react to that?
Please advise, I've read many pages of the FlashMX Bible, many hours spent wasting my time through the feeble 'Help' files associated with Flash MX 2004 pro and more hours trying to find the answer online.
I appreciate any suggestions and conceptual ideas.
TIA,
Spyder