hi everyone... i'm have'n a bit of trouble with a custom graphic...
imagine the recycle'n symbol ( three arrows in a circle ) ... well i'd like to rotate the graphic so that the ' arrow ' that was clicked is on top... and repeat for the other arrows indefinately ... i'm try'n to keep it simple but any ideas are welcome... thanks .. and take care...
Call your arrows arrowA, arrowB and arrowC. Implement them as copies of the same arrow graphic movieclip and put them (rotated and positioned) in a container movie called recycle_mc.
Arrow A should be in the 'home position' on the top. Arrow B should be the next arrow, clockwise.
Make sure the arrows are named within the container movie symbol, and that the container movie is named on the stage. This is so that in the following script, references like recycle_mc.arrowA will work.
This script should be attached to the frame where the recycle_mc first appears.
code:
// These 3 functions set the desired
// angle for each arrow (dividing 360
// into 3 slices) when you click on the arrow
recycle_mc.arrowA.onPress = function()
{
recycle_mc.desiredAngle = 0;
}
// this function keeps the wheel spinning
// until the desired arrow is on top
recycle_mc.onEnterFrame = function()
{
// set desiredAngle to next 'slot' which
// is higher than current _rotation, so that
// we always rotate clockwise
while (this.desiredAngle < this._rotation)
{
this.desiredAngle += 360;
}
// Insure we don't over-rotate
while (this.desiredAngle > this._rotation+360)
{
this.desiredAngle -= 360;
}
var da = this.desiredAngle - this._rotation;
this._rotation += da * .1;
// use higher numbers (.2 .3 etc.)
// for faster speeds
}
// this initializes the wheel
recycle_mc.desiredAngle = 0;
EDIT: Reversed the 120 and 240 after testing - see below.
.. thank you my marvelous friend ( i hope i can call you a friend ) ... this works like a charm ( the code ) .. thanks again.. and i owe you one.. take care.. live long and prosper...