# Rotating symbol?

hi there. i’m new to flash 5. i’ve only learned the basic of actionscripts, but i suck in math.

i’m trying to create an actionscript where i can rotate a symbol in a continuous full 360 degree at one position. i know it has to do with degree/pi, but i can’t come up with the correct formula for it. if i can try to remember, is it 2(pi) for a full rotate? how to put it in the actionscript?

i know this actionscript should be very simple yet i can’t seem to come up with the solution on it!

your help would be very appreciated here!

Full rotate as in clockwise rotation or as in “3D” rotation?

just clockwise rotation… no 3-d at all…

thanks

Just guessing here, but you could put in an [COLOR=blue]onClipEvent (enterFrame)[/COLOR] an increse of [COLOR=blue]_rotate[/COLOR] by a certain amount until it reaches full 360.

I’ll put the code in a sec. Unless someone knows another way in the mean time.

amount = 10;
count = 0
}
onClipEvent (enterFrame) {
_rotation += amount;
count++
if (count == 36) {
amount = 0;
}
}[/COLOR]

This is a simple way of doing it. It just increases by 10 degrees each time, 36 times. It stops when the count reaches 36.

I’m sure someone’s got a fancier way of doing it, but if all you want is 360 degree rotations, this should work.

You can use it as function as well if you want to call it again, even for other symbols.

flex:

many thanks for the code, but i’m trying to figure out how to make it continuous? do i have to make a code that makes it cycle?

If you want to make it continuous just take out some of the code. Just use:

[COLOR=blue]onClipEvent (enterFrame) {
_rotation += 10; (or whatever amount)
}[/COLOR]

The reason why I put a stop after one rotation is because you said you wanted it to rotate 360 degrees. Which is what the code does

flex:

yeah i just figured it out myself already!

thanks flex.

how long have you been programming AS?

Not long at all.