PDA

View Full Version : Rotation in AS



spin3
April 28th, 2003, 12:12 AM
hey, I am a newbe and am wondering how to rotate shape in action script, so that it may be continious.

ahmed
April 28th, 2003, 12:16 AM
have your shape in a movieclip and place this script on the timeline:
speed = 5
mymovieclip.onEnterFrame = function() {
this._rotation += speed
}
try different values for speed and see which fits best :)

spin3
April 28th, 2003, 12:38 AM
I'm a newbe so where in the timeline?, and under the movie, or in the layer for the movie? I've tried a lot of things I think it could be, but they don't work. Also, as long as I am asking questions, how do I get my site in the middle of the web page, like in dreamweaver where it is always in the center?

liam
April 28th, 2003, 01:35 AM
spin -

you'll need to put that code on the root ( main ) timeline. then, be sure to give your movie clip an instance name in the proporties panel. then, change the "mymovieclip" in this code:

speed = 5
mymovieclip.onEnterFrame = function() {
this._rotation += speed
}


to reflect the new instance name. in case you don't know where to put the instance name in, here is a screenshot:

http://www.vmkdsn.com/images/instance.gif

--------------------------------

for your next question, to center something in dreamweaver ( i'm using mx ), just select it and press ctrl+alt+shift+c and you should be done as a nun. pardon the pun.

k wtf that rhymed...

spin3
April 28th, 2003, 01:39 AM
wow, it worked. thanks a lot.

liam
April 28th, 2003, 01:56 AM
glad i could help!

upuaut
April 28th, 2003, 02:25 AM
nice shortcut liam. (ie dreamweaver) I didn't know about that one.

spin3
April 28th, 2003, 05:35 PM
worked great, thx again