<?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>Product Design Thinking and Latest Products from Ben Arent &#187; phidget</title>
	<atom:link href="http://www.benarent.co.uk/bog/category/phidget/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benarent.co.uk/bog</link>
	<description>product design from a new generation of connected, enviromentally aware product designer</description>
	<lastBuildDate>Tue, 18 May 2010 21:44:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using Phidget Sensors to trigger an animation in as3.</title>
		<link>http://www.benarent.co.uk/bog/phidget/using-phidget-sensors-to-trigger-an-animation-in-as3/</link>
		<comments>http://www.benarent.co.uk/bog/phidget/using-phidget-sensors-to-trigger-an-animation-in-as3/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 19:24:05 +0000</pubDate>
		<dc:creator>benarent</dc:creator>
				<category><![CDATA[phidget]]></category>

		<guid isPermaLink="false">http://www.benarent.co.uk/bog/phidget/using-phidget-sensors-to-trigger-an-animation-in-as3/</guid>
		<description><![CDATA[&#160; After recently purchasing a Phidget 8/8/8 Interface kit I started to have some problem using these sensors to drive a flash as3 animation. The Phidget as3 examples are useful but don’t really give ‘real’ world examples for starting to use sensors to drive a flash animation. The solution was to create my own event [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">&nbsp;</p>
<p style="text-align: center"><img src="http://www.benarent.co.uk/bog/wp-content/uploads/2008/03/phidgets.jpg" alt="phidgets magnet sensor" class="imageframe imgaligncenter" height="248" width="600" /></p>
<p class="MsoNormal"><span lang="EN-GB">After recently purchasing a Phidget 8/8/8 Interface kit I started to have some problem using these sensors to drive a flash as3 animation.<span>  </span>The <a href="http://www.phidgets.com/downloads.php?example_id=25">Phidget as3 examples are useful</a>  but don’t really give ‘real’ world examples for starting to use sensors to drive a flash animation.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The solution was to create my own event handerler, this event handler is called in the onSensorChangeFunction, which triggers when there is a onSensorChange Event.</span></p>
<p class="MsoNormal">You can download my a3 phidget slider example <a href="http://www.benarent.co.uk/bog/wp-content/uploads/2008/03/benarent-magnet-example.zip" title="Phidget Manget Example">Phidget Magnet Example</a> .</p>
<p><flv href="http://www.benarent.co.uk/bog/blog_video/phiget_magnet.flv" autostart="false" width="600" height="450"></flv></p>
<p style="text-align: center"><img src="http://www.benarent.co.uk/bog/wp-content/uploads/2008/03/img_0212.jpg" alt="phidgets magnet sensor closeup" class="imageframe imgaligncenter" align="left" height="450" width="600" /></p>
<p><span id="more-201"></span></p>
<blockquote><p> <code>import com.phidgets.*;<br />
import com.phidgets.events.*;<br />
import caurina.transitions.*;</code></p>
<p>var phid:PhidgetInterfaceKit;</p>
<p>phid = new PhidgetInterfaceKit();</p>
<p>phid.addEventListener(PhidgetEvent.CONNECT,onConnect);<br />
phid.addEventListener(PhidgetEvent.DISCONNECT, onDisconnect);<br />
phid.addEventListener(PhidgetEvent.DETACH,onDetach);<br />
phid.addEventListener(PhidgetEvent.ATTACH,onAttach);<br />
phid.addEventListener(PhidgetErrorEvent.ERROR, onError);<br />
phid.addEventListener(PhidgetDataEvent.INPUT_CHANGE, onInputChange);<br />
phid.addEventListener(PhidgetDataEvent.OUTPUT_CHANGE, onOutputChange);<br />
phid.addEventListener(PhidgetDataEvent.SENSOR_CHANGE, onSensorChange);</p>
<p>phid.open(&#8220;localhost&#8221;, 5001);</p>
<p>function onError(evt:PhidgetErrorEvent):void {<br />
trace(evt);<br />
}<br />
function onAttach(evt:PhidgetEvent):void {<br />
trace(evt);<br />
}<br />
function onDetach(evt:PhidgetEvent):void {<br />
trace(evt);<br />
}<br />
function onConnect(evt:PhidgetEvent):void {<br />
trace(evt);<br />
}<br />
function onDisconnect(evt:PhidgetEvent):void {<br />
trace(evt);<br />
}<br />
function onInputChange(evt:PhidgetDataEvent):void {<br />
trace(evt);<br />
}<br />
function onOutputChange(evt:PhidgetDataEvent):void {<br />
trace(evt);<br />
}<br />
function onSensorChange(evt:PhidgetDataEvent):void {<br />
benshanderler(evt);<br />
}<br />
function benshanderler(evt:PhidgetDataEvent):void {<br />
//trace(evt);<br />
if (evt.Index ==0 &amp;&amp; evt.Data&lt;400) {<br />
trace(&#8220;Magnet 1 &#8211; ON&#8221;);<br />
Tweener.addTween(slider1, {_frame:30, time:0.5, transition:&#8221;linear&#8221;});<br />
} else if (evt.Index ==0 &amp;&amp; evt.Data&gt;400) {<br />
trace(&#8220;Magnet 1 &#8211; OFF&#8221;);<br />
Tweener.addTween(slider1, {_frame:0, time:0.5, transition:&#8221;linear&#8221;});<br />
}<br />
if (evt.Index ==1 &amp;&amp; evt.Data&lt;400) {<br />
trace(&#8220;Magnet 2 &#8211; ON&#8221;);<br />
Tweener.addTween(slider2, {_frame:30, time:0.5, transition:&#8221;linear&#8221;});<br />
} else if (evt.Index ==1 &amp;&amp; evt.Data&gt;400) {<br />
trace(&#8220;Magnet 2 &#8211; OFF&#8221;);<br />
Tweener.addTween(slider2, {_frame:0, time:0.5, transition:&#8221;linear&#8221;});<br />
}<br />
if (evt.Index ==2 &amp;&amp; evt.Data&lt;400) {<br />
trace(&#8220;Magnet 3 &#8211; ON&#8221;);<br />
Tweener.addTween(slider3, {_frame:30, time:0.5, transition:&#8221;linear&#8221;});</p>
<p>} else if (evt.Index ==2 &amp;&amp; evt.Data&gt;400) {<br />
trace(&#8220;Magnet 3 &#8211; OFF&#8221;);<br />
Tweener.addTween(slider3, {_frame:0, time:0.5, transition:&#8221;linear&#8221;});<br />
}<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.benarent.co.uk/bog/phidget/using-phidget-sensors-to-trigger-an-animation-in-as3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
