This content has been marked as final. Show 4 replies
Can you provide any specific info regarding what it's supposed to do, what you've done/tried, and what your having a problem with?
ok well im in school for graphic design and me and my teacher was tryin to find a tut that explains how to do it so at home i tried to do like a mouse over kinda tut and that isnt wat i want. wat im lookin to do is this. you kno how a dash board is with the speedometer and all of that? well i have an interface where it is a dash and i want the speedometer to be the nav so u hav u kno home about me ect... and when u roll over the home i want the speedometer needle to follow the mouse. so the needle is gonna be on an axis so it only should go in a circle like a clock would. all i can find so far is preloaders so far still lookin. if u can help it will be greatly appreciated
Odometer and speedometer, two very different animals, though they share the same vicinty on a dashboard. It was hard trying to visualize what you were trying to do with an axis for an odometer.
One way to approach this is to control the _rotation property (angle relative to the normal position) of a needle movieclip. Create a new movieclip symbol and in it draw whatever you intend the needle to look like. Place the drawing such that the center of the movieclip stage is where you want the spinning axis of the needle to be. Your best bet might be to have it originally pointing in a direction relative to where the leftmost button will be so that you only have to deal with positive _rotation values. Place the needle mc on the stage where it's supposed to be and give it an instance name of needle.
In the code for the buttons you want to change the _rotation value of the needle so that its angle changes.
for this example the button will end up being rotated 25 degrees relative to the needle's normal rotation (which is 0 degrees):
needle._rotation = 25;
But that will make the needle immediately move to that angle in a flash... you won't see it gradually move there at all.
So the better approach is to use a tween... use this in its place...
new Tween(needle, "_rotation", Strong.easeOut, needle._rotation, 25, 2, true);
needle._rotation: is the current rotation value
25: is the ending rotation value
2: is the time (sec) you want it to take to get there
In order to use the tween you have to import the classes that support it, which is partly dependent on which version of Flash you're using, but this may work for you... search the Flash help docs regarding Tween if it doesn't
These two lines have to precede that line of code.
Play with it.
If you want the needle to actually follow the mouse movement, my approach would be too mathematical and I don't wanna spend time trying to explain it... it involves figuring out the angle of the mouse relative to the axis of the needle... but that approach wouldn't have the needle stopping at any buttons if you move the mouse away.