Gears

All right then, right to it…

I have a gear on stage which rotates using this script…

//In frame one

r = 0;

//In frame two

setProperty(“gear”, _rotation,r);
r = r +1;

//In frame three

gotoAndPlay (2);

//Here is my question. I want to place a second gear on stage and have it
rotate counter clock-wise. If I wish to use the same script (this script makes
for smother rotation.) What modification do I need to make?

Thanks

Logix

//In frame one

s = 0;

//In frame two

setProperty(“gear2”, _rotation,s);
s=s-1;

//In frame three

gotoAndPlay (2);

:slight_smile:

Thanks David…

That was a fast reply. I appreciate the help.

It works like a charm.

Logix

:bandit:

for the record (I didn’t want to confuse things yesterday by giving you different code to look at.) you can shorten up your property setting method like this

gear2._rotation+=s;

Flash understands a direct call to an object, with version 5.0. So all you have to do is name the object, add a period, and then add the property.

The only trickiness comes into place when the object in question is not on the main stage.

and not that it really saves all that much coding but you can make

s=s-1;

like this

s-=1;

-= means… take anything on the left of this and subtract whatever is on the right of this from it.

same thing with += *= ect.