PDA

View Full Version : Advice needed re rotary switch


Dave Taylor
03-09-2006, 10:47 AM
Need some advice, using Flash 8

I want to make a rotary switch with 3 positions. Backward, Off & Forward (centre off)
The switch will have text above it with Backwards, Off & Forward. When you click on the text the switch rotates to that position.

I am assuming the best way is to make the switch as a movie clip.

But if I do can I and how do I make the Movie Clip play up to the middle frame and stop when I click “off” text, and then play backwards from the middle frame to the 1st frame etc.

Or is there a better way, might in future need to extend it to a 4 pos switch.

Re Dave

frankenscarf
03-09-2006, 12:22 PM
Using MC._rotation, I can get a knob to "jump" to the desired position.

on (release) {
howMuch = (45 - _root.knobPosition);
knob._rotation += howMuch;
_root.knobPosition = 45;
}

_root.knobPosition is set to zero to begin with.
45, in this case, is the desired rotation position.
then i let the other buttons know where the knob is pointing by resetting the _root.knobPosition.

What I can't seem to do is toss this junk into a loop and have the rotation "step" through in increments of, say 3, to achieve a smooth scripted animation.

Little help here? (oh and btw, what's the tag for actionscript instead of PHP?)

frankenscarf
03-09-2006, 05:43 PM
Ok, did a little digging (like I should've done b4 posting :o ) and after a little visit here: http://www.macromedia.com/devnet/fla.../tweening.html I got the attached working.
Hope it helps.

Dave Taylor
03-09-2006, 08:27 PM
Thanks frankenscarf

Perfect, would never had figured that out.

Many Many thanks

Regards, Dave