View Full Version : rotating symbol?
gamma888
September 5th, 2002, 01:25 PM
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!
thanks in advance.
lostinbeta
September 5th, 2002, 01:31 PM
Full rotate as in clockwise rotation or as in "3D" rotation?
gamma888
September 5th, 2002, 03:00 PM
just clockwise rotation... no 3-d at all...
thanks
flex
September 5th, 2002, 03:24 PM
Just guessing here, but you could put in an onClipEvent (enterFrame) an increse of _rotate 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.
flex
September 5th, 2002, 03:34 PM
onClipEvent (load) {
amount = 10;
count = 0
}
onClipEvent (enterFrame) {
_rotation += amount;
count++
if (count == 36) {
amount = 0;
}
}
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.
gamma888
September 5th, 2002, 05:53 PM
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?
flex
September 5th, 2002, 05:59 PM
If you want to make it continuous just take out some of the code. Just use:
onClipEvent (enterFrame) {
_rotation += 10; (or whatever amount)
}
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 :cool:
gamma888
September 5th, 2002, 06:10 PM
flex:
yeah i just figured it out myself already!
thanks flex.
how long have you been programming AS?
flex
September 5th, 2002, 06:59 PM
Not long at all.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.