Constant rotation of an object

I’m trying to get a movieclip to constantly rotate either left or right.
At first I set this._rotation=-1
Then I was thinking of using

[COLOR=Blue] if (this._rotation==1) {
this._rotation = -1;[/COLOR]

But this only makes the object rotate 1 degree and then stop. How do I make it constantly rotate?

use [COLOR=Red]onEnterFrame [/COLOR]or [COLOR=Red]setInterval [/COLOR]function to rotate your object.

I am giving sample code below:

// Assuming you named ur object, my_mc


onEnterFrame = function() {
  my_mc._rotation++;
}


for setInterval function


var interval = setInterval(rotatemc, 100, my_mc);
function rotatemc(mc:MovieClip) {
    mc._rotation++;
}

Do you want it to switch rotation direction at some point?

Great, I’m gonna try that out, Pandu.

And yes Macsy, I also want it to change direction when it hits the right or left edge of the screen.
But I know how to get it to bounce back atleast. :slight_smile:

.