Groups | Blog | Home
all groups > flash actionscript > april 2005 >

flash actionscript : Creating Pivot point for Rotating Image?



Phiba Optix
4/23/2005 6:24:51 PM
Basically I do not want the centre of the image to be the pivot point for the
rotation. So I was wondering if anyone could add to my code for me the
neccessary code so I could select and X,Y point for rotation...

onClipEvent (enterFrame) {
i = getProperty(this,_rotation);
setProperty(this,_rotation,i + 1);
}

Thankyou in advance
Phiba Optix
4/23/2005 7:01:21 PM
cmorrissey
4/23/2005 7:27:51 PM
The pivit point on your movie clip is dependent on the registration mark, this
mark is usually in the topleft of your movie clip (0,0). To change this you
will need to center your movieclip on that point.

To limit the roatation you may want to do something like

i = getProperty(this._rotation);
while( i < = rLimit ){
setProperty(this,_rotation,i + 1);
}

then set rLimit in your movie clip to be the amout of rotation.
kglad
4/23/2005 9:09:08 PM
if you don't want to continue rotating that movieclip indefinitely, you
probably should be using a clipevent attached to the movieclip because you
can't terminate that loop. if you give your rotating movieclip an instance
name, say myMC you can use:

myMC.onEnterFrame=function(){
if (this._rotation<=15) {
this._rotation += 1;
} else {
delete this.onEnterFrame;
}
}
AddThis Social Bookmark Button