<?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>The Burned Out Hippy &#187; Twitter API</title>
	<atom:link href="http://www.burnedouthippy.com/category/twitter-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.burnedouthippy.com</link>
	<description>~ Hugging Flash into submission ~</description>
	<lastBuildDate>Mon, 07 Nov 2011 09:42:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tweeter v1.0 &#8211; simplifying Twitter and Actionscript</title>
		<link>http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/</link>
		<comments>http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 14:46:30 +0000</pubDate>
		<dc:creator>The Hippy</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Classes]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Twitter API]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.burnedouthippy.com/?p=63</guid>
		<description><![CDATA[If you want to add a Twitter feed to your flash website, currently the best way to do it is to pay a visit to Matt Pearson&#8217;s (Zenbullets) Twitter API explanation and buckle down to the code. However if like me you are finding your clients increasingly requesting Twitter feeds in their sites, perhaps you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.burnedouthippy.com/images/tweeter.jpg" alt="Tweeter" /></p>
<p>If you want to add a Twitter feed to your flash website, currently the best way to do it is to pay a visit to <a href="http://actionscripter.co.uk/blog/?page_id=262" target="_blank">Matt Pearson&#8217;s (Zenbullets) Twitter API explanation</a> and buckle down to the code. However if like me you are finding your clients increasingly requesting Twitter feeds in their sites, perhaps you&#8217;ll appreciate my new Tweeter class for ease of re-use.</p>
<p>Try it out:</p>
<p>
<object width="458" height="200">
<param name="movie" value="http://www.burnedouthippy.com/examples/tweeter/TwitterClass.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed type="application/x-shockwave-flash" width="458" height="200" src="http://www.burnedouthippy.com/examples/tweeter/TwitterClass.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>It&#8217;s based around Matt&#8217;s explanations and centres on drawing a single tweet from a single user (using the API&#8217;s &#8220;status&#8221; call). All I&#8217;ve done in my clumsy ham-fisted way is to simplify it for anyone who either doesn&#8217;t have the time to learn it or simply can&#8217;t be bothered. Now all you have to do is use something like the following code for it be up and running in seconds&#8230;</p>
<p><span id="more-63"></span></p>
<p><code>var t:Tweeter = new Tweeter();<br />
t.proxy = "http://www.yourdomain.com";<br />
t.user = "bbcbreaking";<br />
t.getTweet();<br />
addChild(t);</code></p>
<p>I&#8217;ve added a few other customisable options (which I will explain in a moment), but something like the above will have it working for you in seconds. Here&#8217;s a quick explanation of the above before I show you what else you can do with it&#8230;</p>
<p><strong>t.proxy</strong><br />
As Zenbullets explains in his <a href="http://actionscripter.co.uk/blog/?page_id=262" target="_blank">blog post</a>, Flash and Twitter have cross-domain issues. So in order to bypass this you need to run a simple PHP file. I&#8217;ve included this file with the rest of the example files. All you have to do is upload it to your server and point t.proxy at the file&#8217;s location, as in the example above. Please ensure that you add &#8220;http://&#8221; at the beginning and you DON&#8217;T put a &#8220;/&#8221; at the end &#8211; Tweeter will do the rest. <em>Please note: Tweeter will not work without this file</em>.</p>
<p><strong>t.user</strong><br />
This is simply the user name of the Twitter feed you want to pull. eg. if your Twitter page is &#8220;http://www.twitter.com/flashguru20&#8243;, the user name is &#8220;flashguru20&#8243;. If you forget to add this line it will default to The Burned Out Hippy&#8217;s Twitter feed.</p>
<p><strong>t.getTweet()</strong><br />
When you&#8217;ve finished mucking around with the style (I&#8217;ll get to that in a minute), use this line to trigger Tweeter into action.</p>
<p>There are also a couple of other bits and bobs that you should know about that will allow you to style the tweet to your heart&#8217;s content. These are as follows (and should be added <em>before</em> the getTweet trigger):</p>
<p><strong>t.picture = false</strong><br />
This will turn off the user&#8217;s profile picture. Currently the picture aligns to the left of the tweet. In the future I may adapt this so as to allow it&#8217;s location to be top, bottom, left and right &#8211; but as I don&#8217;t need to yet, I haven&#8217;t. So if the user pic isn&#8217;t fitting in with your styling of the text or simply isn&#8217;t to your liking, use the above line to turn it off.</p>
<p><strong>t.loader</strong><br />
I imagine this is a bit naughty, but as I&#8217;m not fully AS3 conversant yet this is the only way I could achieve what I wanted to achieve. &#8220;loader&#8221; is quite simply the main URLRequest that calls the proxy PHP file to get the tweet. I&#8217;ve left it public in order for you to be able to add your own event listeners to it &#8211; so if you want to add a loading animation you can. I may close this back to private at a later date if my knowledge catches up and I find myself horrified at my own code (likely).</p>
<p><strong>t.tweetField</strong><br />
This is the tweet&#8217;s textfield. Again, a bit naughty methinks, but it&#8217;s a means to an end. I&#8217;ve purposefully left it public in order for you to be able style the text to your heart&#8217;s content. </p>
<p>For example, to give the tweet a background colour and change it&#8217;s width you should do something like the following:</p>
<p><code>t.tweetField.background = true;<br />
t.tweetField.backgroundColor = 0xeeeeee;<br />
t.tweetField.width = 280; </code></p>
<p>You can also style the text field using a style sheet. The time and date are wrapped in a <strong>h1</strong> tag and the main text is wrapped in a <strong>p</strong>. If you decide to use my <a href="http://www.burnedouthippy.com/2009/08/the-cssloader-class-v1-0/" target="_blank">CSSLoader class</a>, all you would have to do is create a simple stylesheet and then type something like the following:</p>
<p><code>var cssLoader:CSSLoader = new CSSLoader(t.tweetField, t.tweetField.text, "http://www.yourdomain.com/tweetStyles.css");</code></p>
<p>I&#8217;ve included as much as I can in the example files so that you can get up and running as quickly as possible. Please make sure that you preserve the folder names of my classes or else nothing will work for you. Please also note that Tweeter uses my <a href="http://www.burnedouthippy.com/2009/07/the-findurl-class-v1-0/">FindURL class</a>, so don&#8217;t delete it by accident!</p>
<p><strong>**************************************************************</strong></p>
<p><strong><a href="http://www.burnedouthippy.com/downloads/tweeter/tweeter.zip" target="_blank">You can download Tweeter and the other classes here</a></strong><br />
<strong><a href="http://www.burnedouthippy.com/downloads/tweeter/tweeter_example_files.zip" target="_blank">You can download the examples here</a></strong></p>
<p><strong>**************************************************************</strong></p>
<p>I hope it&#8217;s useful to someone out there. I&#8217;ll be working on a multi-tweet version next (for multiple tweets from a single user) and possibly a keyword search version after that. If you&#8217;d like to see something particular changed or added to this version, please do let me know by leaving a comment below.</p>
<p>Cheerio!</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/share?url=http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/&text=Tweeter+v1.0+%E2%80%93+simplifying+Twitter+and+Actionscript&via=burnedouthippy" title="Post to Twitter"><img class="nothumb" src="http://www.burnedouthippy.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/&amp;t=Tweeter+v1.0+%E2%80%93+simplifying+Twitter+and+Actionscript" title="Post to Facebook"><img class="nothumb" src="http://www.burnedouthippy.com/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://stumbleupon.com/submit?url=http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/&amp;title=Tweeter+v1.0+%E2%80%93+simplifying+Twitter+and+Actionscript" title="Post to StumbleUpon"><img class="nothumb" src="http://www.burnedouthippy.com/wp-content/plugins/tweet-this/icons/en/su/tt-su-micro3.png" alt="Post to StumbleUpon" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/&amp;title=Tweeter+v1.0+%E2%80%93+simplifying+Twitter+and+Actionscript" title="Post to Digg"><img class="nothumb" src="http://www.burnedouthippy.com/wp-content/plugins/tweet-this/icons/en/digg/tt-digg-micro3.png" alt="Post to Digg" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.burnedouthippy.com/2009/08/tweeter-v1-0-simplifying-twitter-and-actionscript/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>

