Re: [Flashcoders] setting the centerpoint of a movieclip?
I took a rotateZ method from Robert Penner's Vector3D class and added a pivotpoint to the formula. It works pretty well as a dynamic registrationpoint :) var mc:MovieClip; var position:Object = {x:mc._x, y:mc._y}; var pivot:Object = {x:position.x+mc._width/2, y:position.y+mc._height/2}; var angle:Number = 0; onEnterFrame = function():Void { angle += 5; rotate(angle); } function rotate(angle:Number):Void { var ca:Number = cosD(angle); var sa:Number = sinD(angle); var x = (position.x - pivot.x) * ca - (position.y - pivot.y) * sa; var y = (position.x - pivot.x) * sa + (position.y - pivot.y) * ca; mc._x = pivot.x + x; mc._y = pivot.y + y; mc._rotation = angle %= 360; } function sinD(angle:Number):Number { return Math.sin (angle * (Math.PI / 180)); } function cosD(angle:Number):Number { return Math.cos (angle * (Math.PI / 180)); } 2006/6/1, grimmwerks [EMAIL PROTECTED]: That'll do it! Thanks. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] setting the centerpoint of a movieclip?
That'll do it! Thanks. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] setting the centerpoint of a movieclip?
http://www.darronschall.com/weblog/archives/54.cfm - Original Message - From: grimmwerks [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Wednesday, May 31, 2006 8:00 PM Subject: [Flashcoders] setting the centerpoint of a movieclip? Is there any way of setting like the regpoint of a movieclip to it's center on the fly without repositioning it? -- ---[ http://www.grimmwerks.com ---[ [EMAIL PROTECTED] ---[ [EMAIL PROTECTED] ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com