Hi
I have searched for hours for the solution on google and forums and I still can't figure out how to center a rotation on movieclip in AS3.
As you can see in my code, I'm trying to adjust on the fly the x and y properties so that the movieclip gives the impression to rotate from its center and not from its corner at 0,0
but it doesn't work and the clip does not rotate well :/Code:var myclip:MovieClip = new MovieClip(); myclip.buttonMode = true; myclip.graphics.beginFill(0); myclip.graphics.drawRect(150, 150, 100, 100); addChild(myclip); myclip.addEventListener(MouseEvent.CLICK,rotate); function rotate(e:Event){ myclip.rotation += 2; myclip.x = (stage.width/2) - (myclip.width/2); myclip.y = (stage.height/2) - (myclip.height/2); }
Please help me if you have any readymade snippet to make a clip rotate from its center or have any idea of what I should modify in my code. I'm kind of lost
Thanks




Reply With Quote