Actionscript makes baby jesus cry <-- new and need help

I’ve been with flash since 4, but have always been very animation heavy. I’ve just recently realized that i need to start to learn to replace some of this animation with actionscript to cut down on filesize, etc. and i only know enough action script to do things like preloaders and basic menu functions… and so… my big question is this.\rhow in gods name do you rotate a symbol by attatching actions to it. Not instantaneous rotation, but the tweening kind. Thanks for reading.\rValmont

you need to add the rotation each time the movie clip enters the frame hence you use \r\ronClipEvent(enterFrame){\r_rotation += 10\r}\r\rthis will add 10 to the rotation of the movieclip, and it will keep adding 10 as long as that clip is on the mainstage. :slight_smile: try to experiment.

thanks, i was trying to do some setProperties stuff, where i could interactively force it to rotate, but not just have it… do it. thanks - btw by “10” in \ronClipEvent(enterFrame){\r_rotation += 10\r}\rdo you mean speed or degrees?\rthanks again\rValmont

ten is the number of degrees. to make it spin faster try 20. that will get the spin. as far as interactivity…what exactly are you trying to do?

Actually it’s “radians” isn’t it?

i thought it was degrees, because in my analogue clock, i have to multiply the minutes and seconds by numbers that equal 360 to get degrees…i might be wrong, i’m under a lot of stress so don’t listen to me…:slight_smile: but i think its degrees…

this is me being too @#%$ lazy to look for the edit button. :slight_smile: but look at this\r\r\rseconds._rotation = s6\r\rthis is part of the code from my clock. There are 60 seconds in a minute, and 360 degrees in a full rotation, so 606 = 360\r\rs*6 = 360 when s = 60. Every time the seconds goes up, the arm will rotate 6 degrees. I think that the 10, is degrees. try this…make a clip with a vertical line, and a circle on top, and put\r\r\ronClipEvent(load){\r_rotation = 45\r}\r\rit should go from | to / that being a 45 degree rotaiton…\r\rI think I’m right, but again, I’m stressed and retarded…actually i saw a very good explanation of trig on the FOE Math Creativity forum, heres the link…\r\rcheck out this link, it looks pretty good, i didn’t look over it all the way yet, but i get my computer back sunday, and then I’ll get my book (hopefully) next friday or so! \r\…/index.htm

nice logic with the clock there - never put any real thought into it. yeah i figure it’s degrees, and the rotattion is continuous, but fluid, so thanks. what i’m trying to do is get down in code this menu system i’ve had stuck in my head for 2 weeks - i made a simple, mostly animation example you can see here: oroborous\ri’m trying to set it up for some nice rollover effects with the circles, the end result being that the circles represent subdirectories, and each part of the circle represent a file - obviously a menu for a website - thanks for all your help thus far\rValmont

hey, I’m lost when it comes to that stuff. I know what code to use to make it do… but radiens to degrees and back again? I get lost.

Actually, our friends at Macromedia’s have cut the pear in 2 (French idiom, never mind). When you write _rotation = 45 ; 45 is degrees, of course, because if you rotate your thing by 45 radians, 1st it’s not at all precise, since radians are multiples or fractions of PI, and then it’s huge !! That would be something like 7 times a full rotation.\r\rNow if you use Math.cos for instance. The correct usage of this function is with radians. If you write Math.cos(45),you’ll get something totally… not what you want.\r\rpom 0]

next question - how to control the direction and occurrence of the rotation based on actionscripted buttons… anyone?\rValmont

Well, making _rotation ++ will produce a clockwise rotation, whereas _rotation – will produce a counterclockwise rotation.\rWhat do you mean by occurrence ?\rpom 0]

actually i found that _rotation -= or _rotation += does the same things, but by occurence i mean, to have a button control the three states of the rotating object - stop, clockwise rotation, and counterclockwise rotation.\r\rI’ve found that by adding a keyframe in the instance of the rotated symbol that has the counter action of the symbols rotation, i can stop the rotation, but only while the button mode (rollover, rollout, onclick, etc.) is active.\r\rSo, what happens is, i have this clockwise rotating symbol, and a button that stops it for a split second.\r\rThe only other thing i did, was using an animation that was exactly the opposite speed of the rotation on the symbol, and pointing the button to the frame that this animation is on…\rbut this will never have the functionality i need.\r\rsniff\rhelp

I was wrong. Poms got it. just modify his code as necessary.

::you want something that will rotate when a button is pressed right? or stop rotating.::\r\rnot exactly - here’s a run down on exactly what i’m trying to do - after the flash loads, there is a symbol rotating on the stage and a button. on rollover, the symbol slows to a stop, and grows 120%. On rollout, it returns to normal. onclick, it stays where it is, and ignores the rollout script, so that it stays stopped and resized.\rany ideas?\r\rvalmont

Put this kind of code in your clip that has to be called rotating :

  \r\ronClipEvent (enterFrame) {\r\r_xscale=_yscale+=(scale-_yscale)/7;\r\r_rotation = (rot-_rotation) ;\r\r}

\rThen in your button

  on (rollOver) _root.rotating.bigger scale...

I’m dead tired. I hope this made sense.\r\rpom 0]

::wants to cry:: no i didn’t get it… ack

There. No more cries. Shshshshhhhh.\rI’m gonna make you a nice fla, just for you. Happy now ?\r\rpom 0]

Sent.\rpom 0]

Lord god in heaven, you did in probably ten minutes what i’ve been experimenting to do for a week - i’m going to take this apart, lick each piece, and put it back together.\rthanks pom.\rlet you know how it goes\rValmont