<?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>Major Callisto</title>
	<atom:link href="http://www.majorcallisto.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.majorcallisto.com</link>
	<description>Flash experiments</description>
	<lastBuildDate>Mon, 06 Feb 2012 20:25:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>A Twitter Follow Button for AS3 Flash</title>
		<link>http://www.majorcallisto.com/uncategorized/a-twitter-follow-button-for-as3-flash/</link>
		<comments>http://www.majorcallisto.com/uncategorized/a-twitter-follow-button-for-as3-flash/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 03:52:18 +0000</pubDate>
		<dc:creator>Major Callisto</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.majorcallisto.com/?p=181</guid>
		<description><![CDATA[// Earlier this year, Twitter introduced Web Intents as an easy way to Tweet, Reply, Retweet, Favorite, and Follow. Web Intents are meant to be used with popups, which means I can easily adapt from my previous Tweet Button for &#8230; <a href="http://www.majorcallisto.com/uncategorized/a-twitter-follow-button-for-as3-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
    function openTweetWin (url) { 		window.open(url, "tweetThis", "width=550,height=450,toolbar=no,scrollbars=no");     }
// ]]&gt;</script></p>
<p><a href="http://www.majorcallisto.com/wp-content/uploads/miniProfileScreen.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/miniProfileScreen.jpg" alt="Follow and Mini-profile" title="Follow and Mini-profile" width="558" height="541" class="alignnone size-full wp-image-185" /></a></p>
<p>Earlier this year, Twitter introduced <a href="https://dev.twitter.com/docs/intents" target="_blank">Web Intents</a> as an easy way to Tweet, Reply, Retweet, Favorite, and Follow. Web Intents are meant to be used with popups, which means I can easily adapt from my previous <a href="http://www.majorcallisto.com/projects/a-tweet-button-for-flash/">Tweet Button for Flash</a> technique: add a javascript popup to the page, set some variables and call the popup from Flash.</p>
<p>Twitter introduced a <a href="https://dev.twitter.com/docs/follow-button" target="_blank">Follow Button</a> that behaves similarly to the <a href="https://dev.twitter.com/docs/tweet-button" target="_blank">Tweet Button</a>, but their claims that it, &#8220;uses the same implementation model&#8221;, is the tiniest bit bullshit. The Follow Button relies on Javascript in ways that we can&#8217;t easily use with Flash.</p>
<p>Our Web Intent Follow Button opens a popup window with a Mini-profile page, as pictured above. The Web Intent Follow Button uses either one of the following two values:</p>
<ul>
<li><strong>screen_name</strong> is the name of the twitter user you&#8217;d like to follow.  <em>e.g. @blacksanta_69</em></li>
<li><strong>user_id</strong> is the id of the twitter user you&#8217;d like to follow. I had a hard time finding my twitter id so I&#8217;m using screen_name instead.</li>
</ul>
<p>Like before, you drop the &#8216;www&#8217; when using Web Intents.</p>
<p>1. The Popup Javascript function needs to be added to your html page in the &lt;head&gt; part of the page. The width and height are hardcoded in the javascript to reflect the Twitter recommended dimensions of a Tweet window. However, this can easily be passed as a parameter from Flash if you want.</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">function</span> openTweetWin <span class="br0">&#40;</span>url<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
window.<span class="kw3">open</span><span class="br0">&#40;</span>url<span class="sy0">,</span> <span class="st0">&quot;tweetThis&quot;</span><span class="sy0">,</span> <span class="st0">&quot;width=550,height=450,toolbar=no,scrollbars=no&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>2. Create a button in flash with the instance name btn_follow and add the following code. It&#8217;s worth noting that this works everywhere except within the Flash IDE, so test it on the html page</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="co1">//Add an Event Listener for the button</span><br />
btn_follow.<span class="me1">addEventListener</span><span class="br0">&#40;</span>MouseEvent.<span class="me1">CLICK</span>, clickFollow<span class="br0">&#41;</span>;<br />
btn_follow.<span class="me1">buttonMode</span> = <span class="kw2">true</span>;</p>
<p><span class="kw2">function</span> clickFollow<span class="br0">&#40;</span><span class="kw3">e</span>:Event<span class="br0">&#41;</span>:<span class="kw3">void</span><span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//The path to the follow &quot;intent&quot; page</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> path:URLRequest = <span class="kw2">new</span> URLRequest<span class="br0">&#40;</span><span class="st0">&quot;https://twitter.com/intent/user&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//using the GET method means you will use a QueryString to send the variables</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//twitter likes this. This is used as an alternate method if we don’t use</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//a javascript popup</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; path.<span class="me1">method</span> = URLRequestMethod.<span class="kw3">GET</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//The URLVariables class is a nice way to keep everything organised. There is the added bonus</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//that we can use these values if we GET instead of using the Javascript popup.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> tweetVars = <span class="kw2">new</span> URLVariables<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tweetVars.<span class="me1">screen_name</span> = <span class="st0">&quot;blacksanta_69&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//tweetVars.user_id = &quot;&quot;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Set the URLRequest to include the URLVariables</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; path.<span class="kw3">data</span> = tweetVars;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//If Flash is okay with us using ExternalInterface</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>ExternalInterface.<span class="me1">available</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">try</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//We’re going to pass this as a string to javascript, so we have to</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//&quot;stringify&quot; it instead of using the URLVariable + URLRequest approach</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//I’m putting a dummy placeholder in the first position of the</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//QueryString so that I can shuffle my variables around without</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//worrying about who gets a ‘?’ instead of a ‘&amp;’. It’s faster than</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//writing a quick if statement, but commenting about it takes far more time ; )</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path.<span class="kw3">url</span> +=<span class="st0">&quot;?d=0&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> <span class="kw1">each</span> <span class="kw1">in</span> tweetVars<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path.<span class="kw3">url</span> += <span class="st0">&quot;&amp;&quot;</span>+<span class="kw1">each</span>+<span class="st0">&quot;=&quot;</span>+tweetVars<span class="br0">&#91;</span><span class="kw1">each</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Make a call to the openTweetWin Javascript function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//and pass it the ‘stringified’ version of the QueryString</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ExternalInterface.<span class="kw3">call</span><span class="br0">&#40;</span><span class="st0">&quot;openTweetWin&quot;</span>, path.<span class="kw3">url</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw3">catch</span> <span class="br0">&#40;</span><span class="kw3">error</span>:SecurityError<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//If it doesn’t work just open a damn window.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw3">catch</span> <span class="br0">&#40;</span><span class="kw3">error</span>:<span class="kw3">Error</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//If it doesn’t work just open a damn window.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//If it doesn’t work just open a damn window.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Gives you:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_followButtonFlash_396199163"
			class="flashmovie"
			width="120"
			height="42">
	<param name="movie" value="/flash/followButton_01/followButtonFlash.swf" />
	<param name="bgcolor" value="#EEEEEE" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/flash/followButton_01/followButtonFlash.swf"
			name="fm_followButtonFlash_396199163"
			width="120"
			height="42">
		<param name="bgcolor" value="#EEEEEE" />
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a> 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<a title="Tweet Button" href="/flash/followButton_01/followButtonFlash.fla">Source FLA Here</a></p>
<p><strong>In HTML</strong></p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc-1">&lt;!&#8211; Simply take the link to twitter and add a querystring (denoted by the &#8216;?&#8217;) at the end with your text Use the &#8216;+&#8217; symbol instead of spaces so browsers can understand (this is called escaping and can be done with javascript) &#8211;&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;https://twitter.com/intent/user?d=0&amp;screen_name=blacksanta_69&quot;</span> <span class="kw3">target</span><span class="sy0">=</span><span class="st0">&quot;_blank&quot;</span>&gt;</span>Follow<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span></div>
</div>
<p>Gives you:<br />
<em><!-- Simply take the link to twitter and add a querystring (denoted by the '?') at the end with your text Use the '+' symbol instead of spaces so browsers can understand (this is called escaping and can be done with javascript) --><a href="https://twitter.com/intent/user?d=0&#038;screen_name=blacksanta_69" target="_blank">Follow</a></em></p>
<p>Because there are so many easy to use features with Web Intents, the logical next step would be to build AS3 classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majorcallisto.com/uncategorized/a-twitter-follow-button-for-as3-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Camera-B-On TV-B-Gone</title>
		<link>http://www.majorcallisto.com/projects/camera-b-on/</link>
		<comments>http://www.majorcallisto.com/projects/camera-b-on/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 05:55:46 +0000</pubDate>
		<dc:creator>Major Callisto</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.majorcallisto.com/?p=142</guid>
		<description><![CDATA[I have created a Camera-B-On TV-B-Gone. This fairly simple mod allows me to use my TV-B-Gone as a camera remote for my Nikon D90. In fact, this will work as a shutter remote for a lot of Nikon cameras. If &#8230; <a href="http://www.majorcallisto.com/projects/camera-b-on/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.majorcallisto.com/wp-content/uploads/DSC_7950.jpg"><img class="alignnone size-full wp-image-146" title="Camera-B-On Switch" src="http://www.majorcallisto.com/wp-content/uploads/DSC_7950.jpg" alt="Camera-B-On Switch" width="1024" height="872" /></a></p>
<p>I have created a Camera-B-On TV-B-Gone. This fairly simple mod allows me to use my TV-B-Gone as a camera remote for my Nikon D90. In fact, this will work as a shutter remote for a lot of Nikon cameras.</p>
<p>If you have a <a href="http://www.adafruit.com/products/46" target="_blank">USBTinyISP</a> you can easily make a Camera-B-On by upgrading your <a href="http://www.adafruit.com/products/73" target="_blank">TV-B-Gone</a>.</p>
<p><a href="http://www.majorcallisto.com/wp-content/uploads/CameraBOn.zip">Download Source CameraBOn.zip</a></p>
<p><iframe src="http://player.vimeo.com/video/31527148?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=0" width="640" height="480" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p>
<h3>Why make a Camera-B-On out of a TV-B-Gone?</h3>
<p>I&#8217;ve made camera remotes before using an arduino board and an IR LED, but there are issues with getting a good range and the form factor is a little bulky.</p>
<p>The Tv-B-Gone is compact, effective and comes built with the ability to have 2 states making it an attractive option. The Tv-B-Gone is about $10 cheaper than a brand name wireless release with the added bonus that you can fuck up TVs. Plus, the Tv-B-Gone was built to be a universal remote and it would be fairly easy to extend it to trigger many cameras. <strong>Right now my model only triggers Nikon cameras</strong> but it would be really easy to add others.</p>
<p>Unfortunately, most cameras need to be set to &#8220;remote&#8221; mode for this to work, so it&#8217;s not like you&#8217;re going to be triggering other people&#8217;s cameras &#8211; at least not to my knowledge. A guerrilla camera tool would be fantastic, but I don&#8217;t think it&#8217;s feasible.</p>
<h3>1. Adding the Nikon code</h3>
<p>The first step was determining the IR Code that would trigger my camera. When I built the arduino version of the shutter release, I used <a href="http://luckylarry.co.uk/arduino-projects/arduino-ir-remote-intervalometer-for-nikon-d80-that-means-timelapse-photography-yarrr/" target="_blank">Lucky Larry&#8217;s arduino intervalometer</a> code, which includes the timing I needed.</p>
<p>Armed with the timing information, I <a href="http://www.ladyada.net/make/tvbgone/design.html" target="_blank">downloaded the source code and read Lady Ada&#8217;s notes on the TV-B-Gone.</a></p>
<p>The program on the TV-B-Gone microcontroller cycles through about 115 known TV &#8220;power&#8221; codes. Each signal code is a series of very fast flashes of infrared light generated by an IR LED on a remote. These patterns of on and off times are chosen to try to avoid triggering the wrong devices. A camera&#8217;s wireless shutter release remote operates the same way.</p>
<p>For the Nikon wireless shutter the times look like this, in microseconds:<br />
2000 on, 27850 off,<br />
390 on, 1580 off,<br />
410 on, 3580 off,<br />
400 on, 63200 off</p>
<p>This signal is sent twice every time the shutter is meant to be &#8220;released&#8221;.</p>
<p>With the TV-B-Gone, the TV codes have been compressed to fit as many as possible on the ATTINY85V chip. Fortunately, <a href="http://www.ladyada.net/make/tvbgone/design.html" target="_blank">Lady Ada describes how this happens</a> well enough for me to do the same conversion by hand:</p>
<ol>
<li>I converted Lucky Larry&#8217;s times from microseconds to the appropriate unit by dividing by ten &#8211; I don&#8217;t think there is a name for that unit, but it&#8217;s the value used in the source code.
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="kw4">const</span> uint16_t code_nikonD90Times<span class="br0">&#91;</span><span class="br0">&#93;</span> PROGMEM <span class="sy0">=</span> <span class="br0">&#123;</span><br />
200<span class="sy0">,</span> 2785<span class="sy0">,</span><br />
39<span class="sy0">,</span> 158<span class="sy0">,</span><br />
41<span class="sy0">,</span> 358<span class="sy0">,</span><br />
40<span class="sy0">,</span> 6320<span class="sy0">,</span><br />
<span class="br0">&#125;</span><span class="sy0">;</span></div>
</div>
</li>
<li>I described the new value as an index in an array of on/off pairs. e.g. [0, 1, 2, 3]</li>
<li> and converted that index value to binary: [00, 01, 10, 11]</li>
<li>I converted those binary values to bytes and then to hex and doubled them to send the signal twice: 0x1b</li>
<li>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="kw4">const</span> uint16_t code_nikonD90Times<span class="br0">&#91;</span><span class="br0">&#93;</span> PROGMEM <span class="sy0">=</span> <span class="br0">&#123;</span><br />
200<span class="sy0">,</span> 2785<span class="sy0">,</span><br />
39<span class="sy0">,</span> 158<span class="sy0">,</span><br />
41<span class="sy0">,</span> 358<span class="sy0">,</span><br />
40<span class="sy0">,</span> 6320<span class="sy0">,</span><br />
<span class="br0">&#125;</span><span class="sy0">;</span><br />
<span class="kw4">const</span> <span class="kw4">struct</span> IrCode code_nikonD90Code PROGMEM <span class="sy0">=</span> <span class="br0">&#123;</span><br />
freq_to_timerval<span class="br0">&#40;</span><span class="nu0">38400</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
<span class="nu0">8</span><span class="sy0">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// # of pairs</span><br />
<span class="nu0">2</span><span class="sy0">,</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// # of bits per index</span><br />
code_nikonD90Times<span class="sy0">,</span><br />
<span class="br0">&#123;</span><br />
0x1B<span class="sy0">,</span><br />
0x1B<span class="sy0">,</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><span class="sy0">;</span></div>
</div>
</li>
</ol>
<p>I then created a .hex file with the new code added.</p>
<h3>2. Programming the TV-B-Gone with a USBTinyISP</h3>
<p>The next step was to program the chip with the new .hex file. This process should involve plugging the TV-B-Gone into my laptop using a <a href="http://www.ladyada.net/make/usbtinyisp/" target="_blank">USB Tiny ISP programmer</a> and software like <a href="http://www.bsdhome.com/avrdude/">AVRDUDE</a>. (<a href="http://www.ladyada.net/learn/avr/avrdude.html" target="_blank">Tutorial here</a>) Unfortunately, AVRDUDE wouldn&#8217;t recognise my TV-B-Gone.</p>
<p>A quick search (<a href="http://forums.adafruit.com/viewtopic.php?f=20&#038;t=4438" target="_blank">here</a>) seemed to suggest that the LEDs draw too much power and might interfere with the chip being recognised. The only suggestion was to disable the resistors or LEDs to program the board. I decided to continue testing and in the process accidentally blew out all four LEDs by using the USBTinyISP power and battery power at the same time. Luckily, this allowed the board to be recognised!</p>
<p>I made a quick trip to <a href="http://creatroninc.com/">Creatron</a> and picked up new IR LEDs and started again. I got the board programmed and the TV-B-Gone worked for both my camera and TV! Hooray!</p>
<h3>3. Camera or TV/Camera mode</h3>
<p>I decided to make one more mod to the TV-B-Gone.</p>
<p>The board allows you to solder a jumper to control whether it uses North America or European codes. I ditched the European codes and opted to add a camera only mode by soldering a tiny &#8220;ON&#8221; switch (or is it &#8220;NO&#8221;?) in place of the jumper. The switch sandwiched nicely between the existing switch and a capacitor. I figured it would be easy to remember &#8220;On&#8221; is for the camera mode since it&#8217;s called a Camera-B-<b>On</b>.</p>
<p><a href="http://www.majorcallisto.com/wp-content/uploads/DSC_7949.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/DSC_7949.jpg" alt="" title="On Switch" width="1024" height="680" class="alignnone size-full wp-image-168" /></a></p>
<p>Unfortunately, I had reinstalled the working LEDs. This meant that I wouldn&#8217;t be able to program the TV-B-Gone anymore. To deal with this, but not wanting to solder another switch to the board, I created a &#8220;detachable joint&#8221; jumper>resistor connection as pictured below to purposefully break the board when needed and allow me to reprogram:<br />
<a href="http://www.majorcallisto.com/wp-content/uploads/DSC_7947.jpg"><img class="alignnone size-full wp-image-145" title="Camera-B-On detachable joint" src="http://www.majorcallisto.com/wp-content/uploads/DSC_7947.jpg" alt="Camera-B-On detachable joint" width="1024" height="680" /></a></p>
<p>Here&#8217;s a self portrait from the above video; I guess autofocus doesn&#8217;t work:<br />
<a href="http://www.majorcallisto.com/wp-content/uploads/DSC_7902.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/DSC_7902.jpg" alt="Self Portrait" title="Self Portrait" width="1024" height="680" class="alignnone size-full wp-image-167" /></a></p>
<h3>Future Revisions</h3>
<p>The obvious next steps for the Camera-B-On is to add intervalometer functionality and support more camera brands. Intervalometers allow photographers to do time lapse. The fact that cameras don&#8217;t come with Intervalometer functionality built in baffles me &#8211; it would be so easy to add.</p>
<p>Here&#8217;s the arduino version I built a while ago:<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="267" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.flickr.com/apps/video/stewart.swf?v=109786" /><param name="flashvars" value="intl_lang=en-us&amp;photo_secret=ee0ec76199&amp;photo_id=5569319197" /><param name="bgcolor" value="#000000" /><param name="allowFullScreen" value="true" /><param name="src" value="http://www.flickr.com/apps/video/stewart.swf?v=109786" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="400" height="267" src="http://www.flickr.com/apps/video/stewart.swf?v=109786" allowfullscreen="true" bgcolor="#000000" flashvars="intl_lang=en-us&amp;photo_secret=ee0ec76199&amp;photo_id=5569319197" data="http://www.flickr.com/apps/video/stewart.swf?v=109786"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.majorcallisto.com/projects/camera-b-on/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mobile Controlled Dress</title>
		<link>http://www.majorcallisto.com/projects/mobile-controlled-dress/</link>
		<comments>http://www.majorcallisto.com/projects/mobile-controlled-dress/#comments</comments>
		<pubDate>Wed, 11 May 2011 18:36:43 +0000</pubDate>
		<dc:creator>Major Callisto</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.majorcallisto.com/?p=78</guid>
		<description><![CDATA[Colour Change Paper Dress from Christopher Lewis on Vimeo. For the past few months I’ve been collaborating with my dear friend Breeyn McCarney on a project called Paper Dolls, which debuted at [FAT] 2011. It was the first fashion show &#8230; <a href="http://www.majorcallisto.com/projects/mobile-controlled-dress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="../wp-content/uploads/BlinkMDressRainbow.jpg"><img title="BlinkM Dress Collage" src="/wp-content/uploads/BlinkMDressRainbow-1024x929.jpg" alt="BlinkM Colour Changes" width="640" height="580" /></a></p>
<p><iframe src="http://player.vimeo.com/video/23664636?title=0&amp;byline=0&amp;portrait=0" width="601" height="338" frameborder="0"></iframe><br /><a href="http://vimeo.com/23664636">Colour Change Paper Dress</a> from <a href="http://vimeo.com/blacksanta69">Christopher Lewis</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>For the past few months I’ve been collaborating with my dear friend <a title="Breeyn McCarney" href="http://www.breeyn.com" target="_blank">Breeyn McCarney</a> on a project called Paper Dolls, which debuted at <a title="[FAT] 2011" href="http://www.alternativefashionweek.com/" target="_blank">[FAT] 2011</a>. It was the first fashion show I&#8217;ve participated in and it was incredibly well received. The highlight for me was taking a bow on the runway at the end of the show; such a thrill!</p>
<div id="attachment_125" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-55.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-55-1024x767.jpg" alt="Breeny McCarney and Christopher Lewis" title="Breeyn McCarney and Christopher Lewis" width="640" height="479" class="size-large wp-image-125" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<p>Breeyn and I initially met to work on ideation together and discuss the possibilities of how technology could be included. The collection consisted of paper dresses augmented with technology. I even got to help cut and assemble some of the paper components, but it was really only a very small fraction of the time Breeyn spent designing and crafting.</p>
<p>The most ambitious and fantastic of the dresses was the <a title="BlinkM" href="http://thingm.com/products/blinkm" target="_blank">BlinkM</a> dress. I&#8217;m simply in love with what we built!</p>
<p><a href="http://www.majorcallisto.com/wp-content/uploads/fat2011_13.jpg"><img class="alignnone size-large wp-image-79" title="BlinkM Dress Backstage" src="http://www.majorcallisto.com/wp-content/uploads/fat2011_13-680x1024.jpg" alt="BlinkM Dress Backstage" width="640" height="963" /></a></p>
<p>The dress is controlled using a mobile application that allows the wearer, or spectators, to change the colour of the dress by simply clicking on one of 16 possible colour choices; it could really be a much higher number of choices, but 16 made for a mobile friendly and easy interface. It was designed with the expectation that a wearer could interact with others, say at a party, and allow other people to remotely control the dress. There is a potential to use the dress for any type of data visualization where colour is an indicator, but I do believe there is also an &#8220;aesthetic utility&#8221; that is being met (it&#8217;s pretty!).</p>
<p><iframe width="560" height="349" src="http://www.youtube.com/embed/wPGFl5Ejs6o" frameborder="0" allowfullscreen></iframe></p>
<p>There are a lot of moving parts to this. First, the dress has 7 BlinkMs embedded in it and can run stand-alone showing random colours, as it did at the [FAT] 2011 show, or connected to and powered by an Arduino board. The Arduino board and lights are controlled by a laptop. The laptop runs <a href="http://code.google.com/p/tinkerit/" target="_blank">TinkerProxy 2</a> which lets a Flash Controller send the desired hue. The hue is written to my laptop from a publicly visible Web Application at <a href="http://colour.breeyn.com" target="_blank">colour.breeyn.com</a>. The Flash Controller reads the hue by pulling a value from a text file; push would have been overkill and because it&#8217;s run locally the latency is fairly low with the hue being updated every 0.5 seconds:</p>
<p><iframe width="560" height="349" src="http://www.youtube.com/embed/dgb-v0woT94" frameborder="0" allowfullscreen></iframe></p>
<p>The mobile control aspect was born from an experiment I did months ago. The apartment I live in is visible from quite far away and I&#8217;m always anxious to see which apartment is mine. I created a setup where I could use a technology called <a title="Megaphone" href="http://megaphonelabs.com/" target="_blank">Megaphone</a> to call a number and turn lights on and off in my apartment so that I could see which apartment was mine. I used BlinkMs so I could change the colour of the lights and distinguish my apartment from others:</p>
<p><iframe width="560" height="349" src="http://www.youtube.com/embed/k4COmjQYq7k" frameborder="0" allowfullscreen></iframe></p>
<p>The simplest of the augmented dresses were decorated with small <a title="LED Throwies" href="http://graffitiresearchlab.com/projects/led-throwies/" target="_blank">LED throwies</a>.</p>
<div id="attachment_80" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/fat2011_17.jpg"><img class="size-large wp-image-80" title="Flower Dress" src="http://www.majorcallisto.com/wp-content/uploads/fat2011_17-680x1024.jpg" alt="Flower Dress" width="640" height="963" /></a><p class="wp-caption-text">Flower Dress with Throwies</p></div>
<div id="attachment_116" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-1.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-1-768x1024.jpg" alt="Hoop Dress" title="Hoop Dress" width="640" height="853" class="size-large wp-image-116" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_117" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-14.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-14-1024x768.jpg" alt="Squiggly Dress" title="Squiggly Dress" width="640" height="480" class="size-large wp-image-117" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_118" class="wp-caption alignnone" style="width: 845px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-22.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-22.jpg" alt="Flower Dress Detail" title="Flower Dress Detail" width="835" height="626" class="size-full wp-image-118" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_119" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-23.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-23-768x1024.jpg" alt="Flower Dress" title="Flower Dress" width="640" height="853" class="size-large wp-image-119" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_120" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-28.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-28-768x1024.jpg" alt="Fan Dress" title="Fan Dress" width="640" height="853" class="size-large wp-image-120" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_121" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-32.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-32-768x1024.jpg" alt="Icing Dress" title="Icing Dress" width="640" height="853" class="size-large wp-image-121" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_122" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-36.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-36-768x1024.jpg" alt="Lamp Dress" title="Lamp Dress" width="640" height="853" class="size-large wp-image-122" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_123" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-46.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-46-768x1024.jpg" alt="BlinkM" title="BlinkM" width="640" height="853" class="size-large wp-image-123" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<div id="attachment_124" class="wp-caption alignnone" style="width: 650px"><a href="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-50.jpg"><img src="http://www.majorcallisto.com/wp-content/uploads/Breeyn-McCarney-FW11-FAT-50-1024x768.jpg" alt="Icing Detail" title="Icing Detail" width="640" height="480" class="size-large wp-image-124" /></a><p class="wp-caption-text">Photo: <a href="http://www.ryanemberley.com/">Ryan Emberley. http://www.ryanemberley.com/</a></p></div>
<p>More photos at <a href="http://www.flickr.com/photos/blacksanta_69/sets/72157626490971049/">http://www.flickr.com/photos/blacksanta_69/sets/72157626490971049/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.majorcallisto.com/projects/mobile-controlled-dress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Tweet Button for Flash</title>
		<link>http://www.majorcallisto.com/projects/a-tweet-button-for-flash/</link>
		<comments>http://www.majorcallisto.com/projects/a-tweet-button-for-flash/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 15:00:40 +0000</pubDate>
		<dc:creator>Major Callisto</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tweet Button]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.majorcallisto.com/?p=15</guid>
		<description><![CDATA[Learn how to create a simple Tweet Button using Flash AS3. <a href="http://www.majorcallisto.com/projects/a-tweet-button-for-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// <![CDATA[
   function openTweetWin (url) { 		window.open(url, "tweetThis", "width=550,height=450,toolbar=no,scrollbars=no");     }
// ]]&gt;</script></p>
<div id="attachment_39" class="wp-caption alignnone" style="width: 579px"><a href="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.37.48-AM.png"><img class="size-full wp-image-39" title="Tweet Button Popup Login" src="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.37.48-AM.png" alt="Tweet Button Popup Login" width="569" height="537" /></a><p class="wp-caption-text">Tweet Button Popup Login</p></div>
<p>Recently, twitter introduced another method of sharing using a Tweet Button and I haven&#8217;t seen many AS3 or Flash friendly solutions. In fact, I&#8217;m a little surprised the folks at twitter snubbed Flash on this one &#8211; there doesn&#8217;t appear to be any Flash friendly documentation.</p>
<p>I suspect the Tweet Button is a direct response to the popularity of Facebook&#8217;s Like Button. At first I didn&#8217;t really see the point &#8211; there already is a way to add a type of status update button and I often don&#8217;t see the point of just jumping on the new thing. However, there are some definite advantages. You can include the following in a Tweet Button:</p>
<ul>
<li><strong>related</strong> allows you to &#8216;recommend&#8217; other twitter profiles for the end-user to follow &#8211; this will show up for the end-user after they&#8217;ve submitted their comment</li>
<li><strong>via</strong> lets you specify a screen name that will get added to the end of the post. <em>e.g. via @blacksanta_69</em></li>
<li><strong>url</strong> lets you specify the path to the page to share. This gets shortened using twitters <a title="t.co" href="http://support.twitter.com/entries/109623" target="_blank">t.co link service</a>. The t.co service is going to be used for all twitter links in the near future</li>
<li><strong>text</strong> value is used for  the content update</li>
</ul>
<p>Additionally, twitter now &#8220;counts&#8221; the number of times an url is tweeted and you have the option to display that on your page. At this point, there isn&#8217;t a way to tap into the count data using the twitter api &#8211; I think you would have to rely on digging through the DOM with Javascript, and that&#8217;s not ideal. Fortunately, displaying the number of tweets seems a little tacky to me (think geocities),  so I haven&#8217;t included that in my Flash approach. However, I have to accept that, like youtube, people are probably more likely to click on things that have millions of tweets. Adding the count is something I&#8217;m going to have to do in the future.</p>
<p>There is also a noticeable advantage in using a branded popup that can be closed and minimizes how intrusive the sharing process can be.</p>
<div id="attachment_38" class="wp-caption alignnone" style="width: 310px"><a href="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.37.23-AM.png"><img class="size-medium wp-image-38" title="Tweet Status Submission" src="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.37.23-AM-300x283.png" alt="Tweet Status Submission" width="300" height="283" /></a><p class="wp-caption-text">Tweet Status Submission</p></div>
<div id="attachment_41" class="wp-caption alignnone" style="width: 310px"><a href="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.38.33-AM.png"><img class="size-medium wp-image-41" title="Related Screen" src="http://www.majorcallisto.com/wp-content/uploads/Screen-shot-2010-09-01-at-10.38.33-AM-300x284.png" alt="Related Screen" width="300" height="284" /></a><p class="wp-caption-text">Related Screen</p></div>
<h3>Tweet Button in AS3 with Javascript Popup</h3>
<p>I&#8217;ve decided to mimic the html Tweet Button functionality as much as possible. This means presenting the user with a custom Tweet Button in Flash, popping up a popup window on click and prepopulating the window.</p>
<p>The single most important thing to remember is to drop the &#8216;www&#8217; when opening the popup window. This screwed me up for a while &#8211; encoding the data you send gets really murky when you post to &#8216;www&#8217;.</p>
<p>1. The Popup Javascript function needs to be added to your html page in the &lt;head&gt; part of the page. The width and height are hardcoded in the javascript to reflect the Twitter recommended dimensions of a Tweet window. However, this can easily be passed as a parameter from Flash if you want.</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">function</span> openTweetWin <span class="br0">&#40;</span>url<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
window.<span class="kw3">open</span><span class="br0">&#40;</span>url<span class="sy0">,</span> <span class="st0">&quot;tweetThis&quot;</span><span class="sy0">,</span> <span class="st0">&quot;width=550,height=450,toolbar=no,scrollbars=no&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>2. Create a button in flash and add the following code. It&#8217;s worth noting that this works everywhere except within the Flash IDE, so test it on the html page</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="co1">//Add an Event Listener for the button</span><br />
btn_tweet.<span class="me1">addEventListener</span><span class="br0">&#40;</span>MouseEvent.<span class="me1">CLICK</span>, clickTweet<span class="br0">&#41;</span>;<br />
btn_tweet.<span class="me1">buttonMode</span> = <span class="kw2">true</span>;</p>
<p><span class="kw2">function</span> clickTweet<span class="br0">&#40;</span><span class="kw3">e</span>:Event<span class="br0">&#41;</span>:<span class="kw3">void</span><span class="br0">&#123;</span></p>
<p><span class="co1">//The path to the share page</span><br />
<span class="kw2">var</span> path:URLRequest = <span class="kw2">new</span> URLRequest<span class="br0">&#40;</span><span class="st0">&quot;http://twitter.com/share&quot;</span><span class="br0">&#41;</span>;</p>
<p><span class="co1">//using the GET method means you will use a QueryString to send the variables</span><br />
<span class="co1">//twitter likes this. This is used as an alternate method if we don&#8217;t use</span><br />
<span class="co1">//a javascript popup</span><br />
path.<span class="me1">method</span> = URLRequestMethod.<span class="kw3">GET</span>;</p>
<p><span class="co1">//The URLVariables class is a nice way to keep everything organised. There is the added bonus</span><br />
<span class="co1">//that we can use these values if we GET instead of using the Javascript popup.</span><br />
<span class="kw2">var</span> tweetVars = <span class="kw2">new</span> URLVariables<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
tweetVars.<span class="kw3">url</span> = <span class="st0">&quot;http://www.majorcallisto.com/?p=15&quot;</span>;<br />
tweetVars.<span class="kw3">text</span> = <span class="st0">&quot;Major Callisto rocks my world with an AS3 Tweet Button&quot;</span>;<br />
tweetVars.<span class="me1">via</span> = <span class="st0">&quot;blacksanta_69&quot;</span>;<br />
tweetVars.<span class="me1">related</span> = <span class="st0">&quot;majorcallisto: Christopher Lewis, Creative Technologist&quot;</span>;</p>
<p><span class="co1">//Set the URLRequest to include the URLVariables</span><br />
path.<span class="kw3">data</span> = tweetVars;</p>
<p><span class="co1">//If Flash is okay with us using ExternalInterface</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span>ExternalInterface.<span class="me1">available</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="co1">//I would imagine that If ExternalInterface wasn&#8217;t available that would be caught</span><br />
<span class="co1">//with the try/catch statement &#8211; oh well.</span><br />
<span class="kw3">try</span><span class="br0">&#123;</span><br />
<span class="co1">//We&#8217;re going to pass this as a string to javascript, so we have to</span><br />
<span class="co1">//&quot;stringify&quot; it instead of using the URLVariable + URLRequest approach</span><br />
<span class="co1">//I&#8217;m putting a dummy placeholder in the first position of the</span><br />
<span class="co1">//QueryString so that I can shuffle my variables around without</span><br />
<span class="co1">//worrying about who gets a &#8216;?&#8217; instead of a &#8216;&amp;&#8217;. It&#8217;s faster than</span><br />
<span class="co1">//writing a quick if statement, but commenting about it takes far more time ; )</span><br />
path.<span class="kw3">url</span> +=<span class="st0">&quot;?d=0&quot;</span>;<br />
<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> <span class="kw1">each</span> <span class="kw1">in</span> tweetVars<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
path.<span class="kw3">url</span> += <span class="st0">&quot;&amp;&quot;</span>+<span class="kw1">each</span>+<span class="st0">&quot;=&quot;</span>+tweetVars<span class="br0">&#91;</span><span class="kw1">each</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="co1">//Make a call to the openTweetWin Javascript function</span><br />
<span class="co1">//and pass it the &#8216;stringified&#8217; version of the QueryString</span><br />
ExternalInterface.<span class="kw3">call</span><span class="br0">&#40;</span><span class="st0">&quot;openTweetWin&quot;</span>, path.<span class="kw3">url</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span> <span class="kw3">catch</span> <span class="br0">&#40;</span><span class="kw3">error</span>:SecurityError<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="co1">//If it doesn&#8217;t work just open a damn window.</span><br />
navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span> <span class="kw3">catch</span> <span class="br0">&#40;</span><span class="kw3">error</span>:<span class="kw3">Error</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="co1">//If it doesn&#8217;t work just open a damn window.</span><br />
navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="co1">//If it doesn&#8217;t work just open a damn window.</span><br />
navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Gives you:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_tweetButton_1516821477"
			class="flashmovie"
			width="120"
			height="42">
	<param name="movie" value="/flash/tweetButton_02/deploy/tweetButton.swf" />
	<param name="bgcolor" value="#EEEEEE" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/flash/tweetButton_02/deploy/tweetButton.swf"
			name="fm_tweetButton_1516821477"
			width="120"
			height="42">
		<param name="bgcolor" value="#EEEEEE" />
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a> 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<a title="Tweet Button" href="/flash/tweetButton_02/source/tweetButtonNew.fla">Source FLA Here</a></p>
<h3>Status updates the old way</h3>
<p>Twitter already has a few methods of &#8216;sharing&#8217; by creating a status update. With a status update you can simply add a <a title="Query String" href="http://en.wikipedia.org/wiki/Query_string" target="_blank">Query String</a> to the end of a link to Twitter. Below is the HTML only example followed by the Flash example I commonly use.</p>
<p><strong>In HTML</strong></p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc-1">&lt;!&#8211; Simply take the link to twitter and add a querystring (denoted by the &#8216;?&#8217;) at the end with your text Use the &#8216;+&#8217; symbol instead of spaces so browsers can understand (this is called escaping and can be done with javascript) &#8211;&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://twitter.com/home?status=Major+Callisto+rocks+my+world+http://www.majorcallisto.com&quot;</span> <span class="kw3">target</span><span class="sy0">=</span><span class="st0">&quot;_blank&quot;</span>&gt;</span>Share This<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span></div>
</div>
<p>Gives you:<br />
<em><!-- Simply take the link to twitter and add a querystring (denoted by the '?') at the end with your text Use the '+' symbol instead of spaces so browsers can understand (this is called escaping and can be done with javascript) --><a href="http://twitter.com/home?status=Major+Callisto+rocks+my+world+with+a+Flash+AS3+Tweet+Button+http://www.majorcallisto.com" target="_blank">Share This</a></em></p>
<p><strong>In AS3:</strong></p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;"><span class="co1">//Import the button class</span><br />
<span class="kw3">import</span> fl.<span class="me1">controls</span>.<span class="kw3">Button</span>;</p>
<p><span class="co1">//Create a button and position it</span><br />
<span class="kw2">var</span> btn_tweet:<span class="kw3">Button</span> = <span class="kw2">new</span> <span class="kw3">Button</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
btn_tweet.<span class="me1">label</span> = <span class="st0">&quot;TWEET&quot;</span>;<br />
btn_tweet.<span class="me1">x</span> = <span class="nu0">10</span>;<br />
btn_tweet.<span class="me1">y</span> = <span class="nu0">10</span>;</p>
<p><span class="co1">//Add the button to the stage</span><br />
addChild<span class="br0">&#40;</span>btn_tweet<span class="br0">&#41;</span>;</p>
<p><span class="co1">//Add an Event Listener for the button</span><br />
btn_tweet.<span class="me1">addEventListener</span><span class="br0">&#40;</span>MouseEvent.<span class="me1">CLICK</span>, clickTweet<span class="br0">&#41;</span>;</p>
<p><span class="kw2">function</span> clickTweet<span class="br0">&#40;</span><span class="kw3">e</span>:Event<span class="br0">&#41;</span><span class="br0">&#123;</span></p>
<p><span class="co1">//The path to the status page</span><br />
<span class="kw2">var</span> path:URLRequest = <span class="kw2">new</span> URLRequest<span class="br0">&#40;</span><span class="st0">&quot;http://twitter.com/home&quot;</span><span class="br0">&#41;</span>;</p>
<p><span class="co1">//using the GET method means you will use a QueryString to send the variables</span><br />
<span class="co1">//twitter likes this</span><br />
path.<span class="me1">method</span> = URLRequestMethod.<span class="kw3">GET</span>;</p>
<p><span class="co1">//The custom status message to send. Might as well let twitter worry about the char count</span><br />
<span class="kw2">var</span> tweetVars:URLVariables = <span class="kw2">new</span> URLVariables<span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="co1">//escape(&quot;Major Callisto rocks my world http://www.majorcallisto.com&quot;);</span></p>
<p><span class="co1">//Twitter uses a &quot;status&quot; variable to prepopulate the page</span><br />
tweetVars.<span class="kw3">status</span> = <span class="st0">&quot;Major Callisto rocks my world with his Flash AS3 Tweet Button http://www.majorcallisto.com&quot;</span>;</p>
<p><span class="co1">//Add the variables to the URLRequest</span><br />
path.<span class="kw3">data</span> = tweetVars;</p>
<p><span class="co1">//Open the page in a &quot;_blank&quot; (new) window and let the user worry about closing</span><br />
navigateToURL<span class="br0">&#40;</span>path, <span class="st0">&quot;_blank&quot;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>Gives you:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_tweetButton_685185968"
			class="flashmovie"
			width="120"
			height="42">
	<param name="movie" value="/flash/tweetButton_01/deploy/tweetButton.swf" />
	<param name="bgcolor" value="#EEEEEE" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/flash/tweetButton_01/deploy/tweetButton.swf"
			name="fm_tweetButton_685185968"
			width="120"
			height="42">
		<param name="bgcolor" value="#EEEEEE" />
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<a title="Tweet Button Source FLA" href="/flash/tweetButton_01/source/tweetButton.fla" target="_blank">Source FLA</a></p>
<p>Now if I can only customize that damn Share This Tweet Button \/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majorcallisto.com/projects/a-tweet-button-for-flash/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>QR Code Sample</title>
		<link>http://www.majorcallisto.com/uncategorized/qr-code-sample/</link>
		<comments>http://www.majorcallisto.com/uncategorized/qr-code-sample/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 15:22:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.majorcallisto.com/?p=4</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ReadQRCodeSample_437166099"
			class="flashmovie"
			width="400"
			height="400">
	<param name="movie" value="http://www.majorcallisto.com/wp-content/uploads/ReadQRCodeSample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.majorcallisto.com/wp-content/uploads/ReadQRCodeSample.swf"
			name="fm_ReadQRCodeSample_437166099"
			width="400"
			height="400">
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> Kaywa QR Code Generator This is an implementation of the libspark.org QR Code Reader created by LOGOSWARE . When the red &#8220;brackets&#8221; turn blue it has read the code. There are lots &#8230; <a href="http://www.majorcallisto.com/uncategorized/qr-code-sample/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ReadQRCodeSample_855793955"
			class="flashmovie"
			width="400"
			height="400">
	<param name="movie" value="http://www.majorcallisto.com/wp-content/uploads/ReadQRCodeSample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.majorcallisto.com/wp-content/uploads/ReadQRCodeSample.swf"
			name="fm_ReadQRCodeSample_855793955"
			width="400"
			height="400">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><a title="Kaywa QR Code Generator" href="http://qrcode.kaywa.com/" target="_blank">Kaywa QR Code Generator</a></p>
<p>This is an implementation of the <a href="http://www.libspark.org/wiki/QRCodeReader/en" target="_blank">libspark.org QR Code Reader</a> created by <a href="http://www.logosware.com" target="_blank">LOGOSWARE</a> . When the red &#8220;brackets&#8221; turn blue it has read the code.</p>
<p>There are lots of issues with using a QR code that I&#8217;m only just realising. For example, the Kaywa gernerator lets you choose a size of QR Code &#8211; I think the dimensions are the same between similar codes but the pixels in the image produced are different. It looks like the information is sometimes truncated for me with smaller size images. This suggests that (obviously) the code reader is very resolution dependant; my camera is low-quality and there is a chip in the lens which I think is contributing to this issue. A slightly better camera would probably be more effective.</p>
<p>I&#8217;m still trying to work out how exactly the QR code works. Initial dives into the class has been spent rummaging through pages and pages of two-dimensional array declarations &#8211; that suggests that these codes may not be that complex.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majorcallisto.com/uncategorized/qr-code-sample/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

