<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pixelbyter &#187; Actionscript 3</title>
	<atom:link href="http://pixelbyter.co.uk/tag/actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelbyter.co.uk</link>
	<description>#rich nicholls</description>
	<lastBuildDate>Tue, 11 May 2010 11:07:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Actionscript 3 draggable objects and kinematics example</title>
		<link>http://pixelbyter.co.uk/2010/01/22/actionscript-3-photo-dragging-example/</link>
		<comments>http://pixelbyter.co.uk/2010/01/22/actionscript-3-photo-dragging-example/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:24:30 +0000</pubDate>
		<dc:creator>pixelbyter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://pixelbyter.local/?p=61</guid>
		<description><![CDATA[I wrote this example a couple of years ago while researching Actionscript 3, inverse kinematics and the mathematic principles behind motion. I&#8217;m currently porting it to a CSS3 example.


Get the Flash source files here.
The following Actionscript 3 snippet is the bread and butter of the code that makes the above example possible:

//calculates angle of centre
var [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this example a couple of years ago while researching Actionscript 3, inverse kinematics and the mathematic principles behind motion. I&#8217;m currently porting it to a CSS3 example.</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="540" height="300"><param name="movie" value="/wp-content/uploads/2010/01/photo_drag.swf" /><object type="application/x-shockwave-flash" data="/wp-content/uploads/2010/01/photo_drag.swf" width="540" height="300"></object><br />
</object></p>
<p><a href="/wp-content/uploads/2010/01/photo_drag_pixelbyter.zip">Get the Flash source files here</a>.</p>
<p>The following <strong>Actionscript 3</strong> snippet is the bread and butter of the code that makes the above example possible:</p>
<pre name="code" class="c">
//calculates angle of centre
var dx:Number = mouseX - thisPhoto.x;
var dy:Number = mouseY - thisPhoto.y;
var angle:Number = Math.atan2(dy, dx);

//handles spinning
var newRotation:Number = (angle - thisPhoto.origAngle) * 180 / Math.PI;

//handles dragging
var newX:Number = mouseX - Math.cos(angle) * thisPhoto.distanceToCentre;
var newY:Number = mouseY - Math.sin(angle) * thisPhoto.distanceToCentre;

//sets new positioning
thisPhoto.x = newX;
thisPhoto.y = newY;
thisPhoto.rotation = newRotation;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://pixelbyter.co.uk/2010/01/22/actionscript-3-photo-dragging-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

