Skip to main content
May 17, 2006
Question

Rotate movie clip with a button mouse over?

  • May 17, 2006
  • 5 replies
  • 412 views
If anyone has any ideas about how to code this, it'd be greatly appreciated.

I have a one frame swf with a few buttons and two movie clips of a wheel. The wheel needs to spin when you mouse over the buttons and stop when not hovering.

I tried setting the property rotation of the clip on roll over, but it doesn't move the wheels continuously or stop where it lands.

Anybody have any ideas? Thanks!
This topic has been closed for replies.

5 replies

May 18, 2006
Thank you so much! That worked perfectly!
Inspiring
May 17, 2006
"shawnA2" <webforumsuser@macromedia.com> wrote in message news:e4fuip$38j$1@forums.macromedia.com...
> If anyone has any ideas about how to code this, it'd be greatly appreciated.
>
> I have a one frame swf with a few buttons and two movie clips of a wheel. The
> wheel needs to spin when you mouse over the buttons and stop when not hovering.
>
> I tried setting the property rotation of the clip on roll over, but it doesn't
> move the wheels continuously or stop where it lands.
>
> Anybody have any ideas? Thanks!
>

Here is the way I would do it.
wheel movieclip has instance name of 'wheel'
2 buttons with instance names of btn1 and btn2
All code is in frame 1, nothing attached to anything.
tralfaz

// ************* wheel stuff ***********
this.wheel.onEnterFrame = function()
{
this._rotation += _root.direction;
}

// ************* button 1 stuff ***********
btn1.onRollOver = function()
{
direction = 5;
}

btn1.onRollOut = function()
{
direction = 0;
}

btn1.onRelease = function()
{
direction = 0; // if you want to stop wheel when button is pressed
}

// ************* button 2 stuff ***********
btn2.onRollOver = function()
{
direction = -5;
}

btn2.onRollOut = function()
{
direction = 0;
}

btn2.onRelease = function()
{
direction = 0; // if you want to stop wheel when button is pressed
}
// ***********************************




May 17, 2006
well I would, but there are multiple buttons and two seperate wheels. that would work way better, but i have to stick to the intial design laid out by the graphics guy. Thanks for your help though!
May 17, 2006
edited.
May 17, 2006
I think it would easier to make the button a movie clip, unless that is what you have, good job. Then try this:

wheel.onRollOver = function() { wheel._roration = wheel._rotation + 25; }
wheel.onRollOut = function() { wheel._roration = wheel._rotation + 0; }
whell.onPress = funciton() { /*what you want it to do*/ };

That is my suggestion.