<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Actionscript 3.0:  Rotate Around Center Point</title>
	<atom:link href="http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/feed/" rel="self" type="application/rss+xml" />
	<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/</link>
	<description>things I learn, as I learn them</description>
	<lastBuildDate>Wed, 16 May 2012 11:32:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Pham Hong Phuc</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-14193</link>
		<dc:creator>Pham Hong Phuc</dc:creator>
		<pubDate>Sun, 19 Jun 2011 07:08:56 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-14193</guid>
		<description>That &#039;s great!! I did and got it work fine. The last problem I have to solve that we have to back it to rotation zero before rotate it any new rotation.</description>
		<content:encoded><![CDATA[<p>That &#8216;s great!! I did and got it work fine. The last problem I have to solve that we have to back it to rotation zero before rotate it any new rotation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Girit</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-13539</link>
		<dc:creator>Girit</dc:creator>
		<pubDate>Thu, 26 May 2011 13:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-13539</guid>
		<description>http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html 

excellent code! THANK YOU!!!</description>
		<content:encoded><![CDATA[<p><a href="http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html" rel="nofollow">http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html</a> </p>
<p>excellent code! THANK YOU!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subash</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-10075</link>
		<dc:creator>Subash</dc:creator>
		<pubDate>Fri, 20 Aug 2010 18:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-10075</guid>
		<description>Have a look at this page.

http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html</description>
		<content:encoded><![CDATA[<p>Have a look at this page.</p>
<p><a href="http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html" rel="nofollow">http://subashflash.blogspot.com/2010/08/rotation-of-object-based-on-center.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Apostolov</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-9962</link>
		<dc:creator>Daniel Apostolov</dc:creator>
		<pubDate>Fri, 06 Aug 2010 16:53:39 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-9962</guid>
		<description>Hi,

This approach has one disadvantage - the rotation is always relative to the previous rotation and after a large number of iterations rounding error is accumulated. A possible solution can be found here:

http://itforum.webrichservices.com/viewtopic.php?f=127&amp;t=14

Thank you for your original posing anyway, it helped me to understand a bit better how Flash works...</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>This approach has one disadvantage &#8211; the rotation is always relative to the previous rotation and after a large number of iterations rounding error is accumulated. A possible solution can be found here:</p>
<p><a href="http://itforum.webrichservices.com/viewtopic.php?f=127&#038;t=14" rel="nofollow">http://itforum.webrichservices.com/viewtopic.php?f=127&#038;t=14</a></p>
<p>Thank you for your original posing anyway, it helped me to understand a bit better how Flash works&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-9619</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sat, 05 Jun 2010 20:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-9619</guid>
		<description>I have tried this and cannot get it to work on a rectangle. Seems all the transform matrix examples of rotation use a square or worse, a circle. These examples only seem to work ONCE on a rectangle. Subsequent calls to rotate the  rectangel have it spriralling off the stage.</description>
		<content:encoded><![CDATA[<p>I have tried this and cannot get it to work on a rectangle. Seems all the transform matrix examples of rotation use a square or worse, a circle. These examples only seem to work ONCE on a rectangle. Subsequent calls to rotate the  rectangel have it spriralling off the stage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 3piotik</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-9339</link>
		<dc:creator>3piotik</dc:creator>
		<pubDate>Wed, 05 May 2010 13:31:12 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-9339</guid>
		<description>полет фантазии надо срочно остановить, а то улетит незнамо куда и не поймаешь :))</description>
		<content:encoded><![CDATA[<p>полет фантазии надо срочно остановить, а то улетит незнамо куда и не поймаешь <img src='http://ryanbosinger.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomas.teicher</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-9044</link>
		<dc:creator>tomas.teicher</dc:creator>
		<pubDate>Sun, 04 Apr 2010 09:56:41 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-9044</guid>
		<description>for me this does not work. It is rotating but not around the center. It looks like it works only first 2 or 3 rounds and then my Spite starts to decline. If anyone could help me, I add simple code:

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.*;
	
	
	/**
	 * ...
	 * @author tomas.teicher
	 */
	public class Main extends Sprite 
	{
		public var rect:Sprite;
		public var bod:Point;
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			rect = new Sprite();
			rect.graphics.beginFill(0x00ff00);
			rect.graphics.drawRect(0, 0, 100, 100);
			rect.graphics.endFill();
			addChild(rect);
			
			bod = new Point(rect.x + rect.width/2, rect.y+rect.height/2);
			addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
			
		}
		
		 private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point):void {
      var m:Matrix=ob.transform.matrix;
      m.tx -= ptRotationPoint.x;
      m.ty -= ptRotationPoint.y;
      m.rotate (angleDegrees*(Math.PI/180));
      m.tx += ptRotationPoint.x;
      m.ty += ptRotationPoint.y;
      ob.transform.matrix=m;
      }
	  
	  function enterFrameHandler(event:Event):void {
		 rotateAroundCenter (rect, 1, bod); 
	  }
	}
	
}</description>
		<content:encoded><![CDATA[<p>for me this does not work. It is rotating but not around the center. It looks like it works only first 2 or 3 rounds and then my Spite starts to decline. If anyone could help me, I add simple code:</p>
<p>package<br />
{<br />
	import flash.display.Sprite;<br />
	import flash.events.Event;<br />
	import flash.geom.*;</p>
<p>	/**<br />
	 * &#8230;<br />
	 * @author tomas.teicher<br />
	 */<br />
	public class Main extends Sprite<br />
	{<br />
		public var rect:Sprite;<br />
		public var bod:Point;</p>
<p>		public function Main():void<br />
		{<br />
			if (stage) init();<br />
			else addEventListener(Event.ADDED_TO_STAGE, init);<br />
		}</p>
<p>		private function init(e:Event = null):void<br />
		{<br />
			removeEventListener(Event.ADDED_TO_STAGE, init);<br />
			// entry point<br />
			rect = new Sprite();<br />
			rect.graphics.beginFill(0x00ff00);<br />
			rect.graphics.drawRect(0, 0, 100, 100);<br />
			rect.graphics.endFill();<br />
			addChild(rect);</p>
<p>			bod = new Point(rect.x + rect.width/2, rect.y+rect.height/2);<br />
			addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);</p>
<p>		}</p>
<p>		 private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point):void {<br />
      var m:Matrix=ob.transform.matrix;<br />
      m.tx -= ptRotationPoint.x;<br />
      m.ty -= ptRotationPoint.y;<br />
      m.rotate (angleDegrees*(Math.PI/180));<br />
      m.tx += ptRotationPoint.x;<br />
      m.ty += ptRotationPoint.y;<br />
      ob.transform.matrix=m;<br />
      }</p>
<p>	  function enterFrameHandler(event:Event):void {<br />
		 rotateAroundCenter (rect, 1, bod);<br />
	  }<br />
	}</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rbosinger</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-893</link>
		<dc:creator>rbosinger</dc:creator>
		<pubDate>Wed, 19 Nov 2008 22:11:51 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-893</guid>
		<description>Well, keep in mind that it is also possible to center the contents of a movieclip so that the registration point sits in the middle.  Then the normal &quot;rotate&quot; property would rotate around center.  Yes, I&#039;m surprised there isn&#039;t a built in function that would do that for you.  There&#039;s probably a reason for it.  This is a quick fix, although it is a very powerful because knowing how to use the Matrix class will enable you to do all kinds of image transformations.  I imagine in the future the type of functionality that the &quot;TransformMatrixProxy&quot; offers might be built right in.</description>
		<content:encoded><![CDATA[<p>Well, keep in mind that it is also possible to center the contents of a movieclip so that the registration point sits in the middle.  Then the normal &#8220;rotate&#8221; property would rotate around center.  Yes, I&#8217;m surprised there isn&#8217;t a built in function that would do that for you.  There&#8217;s probably a reason for it.  This is a quick fix, although it is a very powerful because knowing how to use the Matrix class will enable you to do all kinds of image transformations.  I imagine in the future the type of functionality that the &#8220;TransformMatrixProxy&#8221; offers might be built right in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xav</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-891</link>
		<dc:creator>Xav</dc:creator>
		<pubDate>Wed, 19 Nov 2008 21:51:28 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-891</guid>
		<description>Ok it works, but why the hell didn&#039;t they put centering properties in actionscript ? Isn&#039;t this pure stupidity, given that it is still missing in CS4 ?</description>
		<content:encoded><![CDATA[<p>Ok it works, but why the hell didn&#8217;t they put centering properties in actionscript ? Isn&#8217;t this pure stupidity, given that it is still missing in CS4 ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: niceBoat</title>
		<link>http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/comment-page-1/#comment-136</link>
		<dc:creator>niceBoat</dc:creator>
		<pubDate>Tue, 09 Sep 2008 23:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://ryanbosinger.com/blog/?p=32#comment-136</guid>
		<description>Thanks a lot for posting this!</description>
		<content:encoded><![CDATA[<p>Thanks a lot for posting this!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
