<?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>To Wonder Multimedia &#187; experiment</title>
	<atom:link href="http://www.to-wonder.com/tag/experiment/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.to-wonder.com</link>
	<description>Development &#38; Design</description>
	<lastBuildDate>Tue, 31 Jan 2012 09:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WiiFlash and the IR sensor</title>
		<link>http://www.to-wonder.com/2011/11/wiiflash-and-the-ir-sensor/</link>
		<comments>http://www.to-wonder.com/2011/11/wiiflash-and-the-ir-sensor/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 09:00:03 +0000</pubDate>
		<dc:creator>Luc Princen</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[wiiflash]]></category>
		<category><![CDATA[wiimote]]></category>

		<guid isPermaLink="false">http://www.to-wonder.com/?p=853</guid>
		<description><![CDATA[This post is in english due to the scarce information on this subject. Last time I talked about getting WiiFlash to run on OSX Lion, which was tricky since WiiFlash hasnt&#8217; been updated for more than two years. And that&#8217;s really too bad, the library works&#8230; it just needs some tender, love and care. I&#8217;m... <a href="http://www.to-wonder.com/2011/11/wiiflash-and-the-ir-sensor/" style="text-decoration:none;font-size:11px;font-weight:bold">&#160;MEER &#8250;&#160;&#160;</a>]]></description>
			<content:encoded><![CDATA[<p>This post is in english due to the scarce information on this subject. Last time <a href="http://www.to-wonder.com/2011/11/wiiflash-and-osx/" target="_blank">I talked about getting WiiFlash to run on OSX Lion</a>, which was tricky since WiiFlash hasnt&#8217; been updated for more than two years. And that&#8217;s really too bad, the library works&#8230; it just needs some tender, love and care. I&#8217;m still looking for people who are interested in forking WiiFlash and rebuilding some of the library so it connects properly with OSX Lion and can receive sounds (the sound-stuff hasn&#8217;t been &#8216;unlocked&#8217; yet).</p>
<p>&nbsp;</p>
<p>Anyway, i&#8217;m writing a blogpost about WiiFlash and the IR sensor, because I found it was hard to get the material I needed and after getting the material I got stuck with scripts which made the IR sensor work, but in mirror-mode, so if you&#8217;re looking for some PROPPER information about this subject, you&#8217;re at the right address.</p>
<p>&nbsp;</p>
<p>This is basically my root class, add anything you want:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:'Monaco', Courier, monospace;">&nbsp;
package<span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">wiiflash</span>.<span style="color: #006600;">Wiimote</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">wiiflash</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ButtonEvent</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">wiiflash</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">WiimoteEvent</span>;
&nbsp;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WiiMoteRoot <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myWiimote:Wiimote = <span style="color: #000000; font-weight: bold;">new</span> Wiimote<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> pointOne:Point = <span style="color: #000000; font-weight: bold;">new</span> Point;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> pointTwo:Point = <span style="color: #000000; font-weight: bold;">new</span> Point;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> WiiMoteRoot<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// connect wiimote to WiiFlash Server</span>
			myWiimote.<span style="color: #0066CC;">connect</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			myWiimote.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> WiimoteEvent.<span style="color: #006600;">UPDATE</span>, onUpdated <span style="color: #66cc66;">&#41;</span>;
			myWiimote.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> ButtonEvent.<span style="color: #006600;">A_PRESS</span>, onAPressed <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> onAPressed<span style="color: #66cc66;">&#40;</span>evt:ButtonEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
			myWiimote.<span style="color: #006600;">rumbleTimeout</span> = <span style="color: #cc66cc;">100</span>;
			<span style="color: #808080; font-style: italic;">//you can add more interesting stuff over here.</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> onUpdated<span style="color: #66cc66;">&#40;</span>evt:WiimoteEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
  	    	        <span style="color: #808080; font-style: italic;">/* Now, for the IR sensor:
	    	           The WiiMote works with two infra red dots to calculate the 
	    	           position. So we have to get those two points and calculate 
	    	           the middle. */</span>
&nbsp;
                        <span style="color: #000000; font-weight: bold;">var</span> thePoint:Point = Point.<span style="color: #006600;">interpolate</span><span style="color: #66cc66;">&#40;</span> myWiimote.<span style="color: #006600;">ir</span>.<span style="color: #006600;">point1</span>, myWiimote.<span style="color: #006600;">ir</span>.<span style="color: #006600;">point2</span>,.5<span style="color: #66cc66;">&#41;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">//trace(thePoint.x + ' -- '+ thePoint.y);</span>
&nbsp;
	    	        <span style="color: #808080; font-style: italic;">//Put an MC named cursor (in my file already on the stage) on this position:</span>
	    	        <span style="color: #808080; font-style: italic;">//We need to subtract the X from one and multiply the Y by -1 to get out of 'mirrored mode'.</span>
        	        cursor.<span style="color: #006600;">x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span> -thePoint.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span>;
        	        cursor.<span style="color: #006600;">y</span> = <span style="color: #66cc66;">&#40;</span>thePoint.<span style="color: #006600;">y</span> <span style="color: #66cc66;">*</span> -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p>If you have any questions, i&#8217;ll be glad to answer them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.to-wonder.com/2011/11/wiiflash-and-the-ir-sensor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WiiFlash &amp; OSX 10.6+</title>
		<link>http://www.to-wonder.com/2011/11/wiiflash-and-osx/</link>
		<comments>http://www.to-wonder.com/2011/11/wiiflash-and-osx/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 09:00:09 +0000</pubDate>
		<dc:creator>Luc Princen</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[wiiflash]]></category>
		<category><![CDATA[wiimote]]></category>

		<guid isPermaLink="false">http://www.to-wonder.com/?p=796</guid>
		<description><![CDATA[This post is in english, since I&#8217;ve found that getting information on this subject was pretty hard to come by. I&#8217;ve been searching for a good open source AS3 library to &#8216;talk&#8217; to the WiiMote today and I found one in WiiFlash, it can turn WiiMote data into a bytearray which you can easily access... <a href="http://www.to-wonder.com/2011/11/wiiflash-and-osx/" style="text-decoration:none;font-size:11px;font-weight:bold">&#160;MEER &#8250;&#160;&#160;</a>]]></description>
			<content:encoded><![CDATA[<p>This post is in english, since I&#8217;ve found that getting information on this subject was pretty hard to come by. I&#8217;ve been searching for a good open source AS3 library to &#8216;talk&#8217; to the WiiMote today and I found one in <a title="WiiFlash" href="http://wiiflash.bytearray.org/" target="_blank">WiiFlash</a>, it can turn WiiMote data into a bytearray which you can easily access in Flash with the AS3 classes WiiFlash comes with. Now, this library hasn&#8217;t been updated in a while so it didn&#8217;t come as a surprise to me that it presented me with some problems on Mac OSX Lion (10.7.2). I&#8217;ve also read that it gives loads of problems on Mac OSX Snow Leopard and basically any 64-bit system with dual-core chips.</p>
<p>&nbsp;</p>
<p>A simple problem (pretty well explained by the WiiFlash website) was that the app wouldn&#8217;t launch in a 64-bit architectures, so you need to right-click on the app and check off &#8216;run in 32-bit-mode&#8217;.</p>
<p>&nbsp;</p>
<p>A bigger problem was that OSX Lion was just too damn good in recognizing the WiiMote. It hogged a connection before the open source servers could connect to it. And as you (probably) know, a bluetooth connection can only occur between two devices (or entities), in this case the OSX kernel connected to it before WiiFlash could. It turns out that Apple did a very good job of adding bluetooth devices to the HID manager (that&#8217;s the part of the OS that immediately needs to recognize connected mouses and keyboards), so my WiiMote never had a chance.</p>
<p>&nbsp;</p>
<p>I&#8217;m not the type to throw in the towel at that point, I&#8217;m the type that likes to stack tab onto tab in Chrome to find the fricking answer. <strong>And i found it! </strong>With a little (free) library called <a title="Wiiji Library" href="http://wiiji.veltrop.com/" target="_blank">Wiiji</a>, you can overwrite certain HID-manager preferences (please watch out with this if you&#8217;re an avid wireless keyboard or mouse user) to give WiiFlash a fighting chance.</p>
<p>&nbsp;</p>
<p>I&#8217;m currently trying to make the WiiFlash library a bit more stable on OSX Lion as it still has crash problems. I&#8217;ll keep you updated on that.</p>
<p>&nbsp;</p>
<p>You can <a title="WiiFlash" href="http://wiiflash.bytearray.org/" target="_blank">download WiiFlash over here</a></p>
<p>And <a href="http://wiiji.veltrop.com/" target="_blank">get Wiiji over here</a></p>
<p>&nbsp;</p>
<p>I&#8217;ll probably be adding some more blogposts about WiiFlash, Actionscript 3 and the WiiMote and AS3 and some other tactile input devices in the future, so definitely stay tuned!</p>
<p>Happy experimenting!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.to-wonder.com/2011/11/wiiflash-and-osx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

