<?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>Woven Interactive &#187; Actionscript</title>
	<atom:link href="http://woveninteractive.net/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://woveninteractive.net</link>
	<description>Flash, Flex, Papervision, Interactive Agency</description>
	<lastBuildDate>Wed, 11 Nov 2009 17:36:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tracking Time : Brightcove with GAForFlash Event Tracking</title>
		<link>http://woveninteractive.net/2009/04/tracking-time-brightcove-with-gaforflash-event-tracking/</link>
		<comments>http://woveninteractive.net/2009/04/tracking-time-brightcove-with-gaforflash-event-tracking/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 16:49:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Brightcove]]></category>
		<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[Flash Analytics]]></category>
		<category><![CDATA[Video Player]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Event Tracking]]></category>
		<category><![CDATA[Flash Development]]></category>
		<category><![CDATA[GAforFlash]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Interactive Agency]]></category>
		<category><![CDATA[Video Player Tracking]]></category>
		<category><![CDATA[Woven Interactive]]></category>

		<guid isPermaLink="false">http://woveninteractive.net/?p=115</guid>
		<description><![CDATA[
When your business is making money based on time then tracking time is of obvious importance. With a little Flash wizardry and the GAforFlash tracking classes you can easily accomplish this task.
In our tests the 3 important metrics to test against were:
1) Player load time
2) Amount of time it takes for the first video to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://woveninteractive.net/wp-content/uploads/2009/04/brightcove-and-google.jpg" alt="brightcove-and-google" title="brightcove-and-google" width="475" height="300" class="alignnone size-full wp-image-117" /></p>
<p>When your business is making money based on time then tracking time is of obvious importance. With a little Flash wizardry and the <a href="http://code.google.com/p/gaforflash/">GAforFlash</a> tracking classes you can easily accomplish this task.</p>
<p>In our tests the 3 important metrics to test against were:</p>
<p>1) Player load time<br />
2) Amount of time it takes for the first video to play<br />
3) Duration player was being viewed (5 and then 10 second interval ) </p>
<p>To get the player load time and then the video playing time we first grab the current time when the swf initially loads:</p>
<div class="igBar"><span id="lactionscript-7"><a href="#" onclick="javascript:showCodeTxt('actionscript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-7">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">startTime = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">time</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>When brightcove loads the player we listen for the template loaded event</p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showCodeTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_player.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ExperienceEvent.<span style="color: #006600;">TEMPLATE_LOADED</span>, onTemplateLoaded<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now that we have our first metric to work with we send that information to google and start working on our next metric:</p>
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showCodeTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">protected <span style="color: #000000; font-weight: bold;">function</span> onTemplateLoaded<span style="color: #66cc66;">&#40;</span>evt:ExperienceEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Time to load tracking</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; timeToLoad = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">time</span> - startTime<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playerID<span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playlistID<span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">"Player Load Time"</span>, timeToLoad<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Get the Experience Module</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; expModule &nbsp; = _player.<span style="color: #006600;">getModule</span><span style="color: #66cc66;">&#40;</span>APIModules.<span style="color: #006600;">EXPERIENCE</span><span style="color: #66cc66;">&#41;</span> as ExperienceModule;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Get Modules from BEML</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; _videoItem &nbsp;= expModule.<span style="color: #006600;">getElementByID</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"videoPlayer"</span><span style="color: #66cc66;">&#41;</span> as VideoPlayerModule</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//Now that the template is ready we can start tracking media events</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _videoItem.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MediaEvent.<span style="color: #006600;">BEGIN</span>, onBegin<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Next is to track when the user sees the first video playing:</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showCodeTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">protected <span style="color: #000000; font-weight: bold;">function</span> onBegin<span style="color: #66cc66;">&#40;</span>evt:MediaEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//This is fired each time a new video begins. One way around this is to</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//set a Boolean as to if any video has started - or remove the event listener</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//since we were tracking other items we chose to leave the listener alone</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>videoStarted == <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; timeToLoad = <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">time</span> - startTime<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playerID<span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>currPlaylistID<span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">"First Video Playing"</span>, timeToLoad<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; videoStarted = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Our final metric was one that we were most interested in. This tracks the time spent actually viewing the entire video player. </p>
<p>The solution to this is very simple. Our solution was to use a timer based solution as follows. You can download the <a href="http://code.google.com/p/foomonger/">foomonger later classes here</a>. Or just use a the built in Flash Timer.</p>
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showCodeTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Later.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sendEvery10, <span style="color: #cc66cc;color:#800000;">5000</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">protected <span style="color: #000000; font-weight: bold;">function</span> sendEvery10<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Later.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sendEvery10, <span style="color: #cc66cc;color:#800000;">10000</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>firstTimeRecord<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playerID<span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>currPlaylistID<span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">"Amount Spent Viewing"</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; firstTimeRecord = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playerID<span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>currPlaylistID<span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">"Amount Spent Viewing"</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This report will now show you how long your video player is live on a persons computer. If you want to track this on a per session basis you would just want to add a random variable as follows:</p>
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showCodeTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>playerID<span style="color: #66cc66;">&#41;</span>,&nbsp; <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>currPlaylistID + <span style="color: #ff0000;">"-"</span> +myRandomVar ,<span style="color: #ff0000;">"Amount Spent Viewing"</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hopefully this saves some of you a lot of time with implementation into your own video players. </p>
<p>If you or your clients need any help, feel free to contact our <a href="http://www.woveninteractive.com">interactive agency</a>. We will be happy to assist.</p>
]]></content:encoded>
			<wfw:commentRss>http://woveninteractive.net/2009/04/tracking-time-brightcove-with-gaforflash-event-tracking/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Side Scrolling Fish Swim Game with APE Physics Engine</title>
		<link>http://woveninteractive.net/2009/04/side-scrolling-fish-swim-game-with-ape-physics-engine/</link>
		<comments>http://woveninteractive.net/2009/04/side-scrolling-fish-swim-game-with-ape-physics-engine/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 17:57:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Games]]></category>
		<category><![CDATA[Flash Physics Engine]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[APE Physics Engine]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Atlanta Interactive Agency]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Flash Game Design]]></category>
		<category><![CDATA[Flash Physics]]></category>

		<guid isPermaLink="false">http://woveninteractive.net/?p=90</guid>
		<description><![CDATA[
In an effort to find a very simple and easy to use physics engine we stumbled upon APE. Although this is not the most powerful of Flash physics engines it does seem to have a rather minimal learning curve.
There are several other physics engines in AS3 available. The one that seems to currently be the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.woveninteractive.com/dev/testing/fish-game.html"><img src="http://woveninteractive.net/wp-content/uploads/2009/04/ape-engine-game.jpg" alt="ape-engine-game" title="ape-engine-game" width="475" height="219" class="alignnone size-full wp-image-89" /></a></p>
<p>In an effort to find a very simple and easy to use physics engine we stumbled upon <a href="http://www.cove.org/ape/">APE</a>. Although this is not the most powerful of Flash physics engines it does seem to have a rather minimal learning curve.</p>
<p>There are several other physics engines in AS3 available. The one that seems to currently be the leader of the pack is <a href="http://box2dflash.sourceforge.net/">Box2D</a>. Box2D is a port from C++ so package names / method names etc do not follow Actionscript best practices (lowercase package names &#038; uppercase method names). Not really a big deal but a little odd at times. </p>
<p>For this game it seemed that APE had plenty of features and power to get the desired result. </p>
<p>Monsters (fish), and coins were easily placed in an array</p>
<div class="igBar"><span id="lactionscript-15"><a href="#" onclick="javascript:showCodeTxt('actionscript-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-15">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> monsters:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span> <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">1500</span>, y:<span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">1700</span>, y:<span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">2500</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">2700</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">3200</span>, y:<span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">3700</span>, y:<span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">3900</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">4000</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">4300</span>, y:<span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">4500</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">5000</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">5500</span>, y:<span style="color: #cc66cc;color:#800000;">150</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">6000</span>, y:<span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">6200</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">6700</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">7000</span>, y:<span style="color: #cc66cc;color:#800000;">120</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">7700</span>, y:<span style="color: #cc66cc;color:#800000;">350</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">8300</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">9000</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">9300</span>, y:<span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">9800</span>, y:<span style="color: #cc66cc;color:#800000;">180</span>, <span style="color: #0066CC;">type</span>:Starfish <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">10000</span>, y:<span style="color: #cc66cc;color:#800000;">330</span>, <span style="color: #0066CC;">type</span>:Octo <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">1600</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">1900</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">2200</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">3500</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">3800</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">4600</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">9600</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">11000</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">12000</span>, y:<span style="color: #cc66cc;color:#800000;">220</span>, <span style="color: #0066CC;">type</span>:Coin <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Movement is as simple as adding force to an object:</p>
<div class="igBar"><span id="lactionscript-16"><a href="#" onclick="javascript:showCodeTxt('actionscript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-16">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onKeyDown</span><span style="color: #66cc66;">&#40;</span>evt:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">UP</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; forceAmountY = -<span style="color: #cc66cc;color:#800000;">25</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">DOWN</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; forceAmountY = <span style="color: #cc66cc;color:#800000;">25</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; forceAmount = <span style="color: #cc66cc;color:#800000;">6</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; forceAmount = -<span style="color: #cc66cc;color:#800000;">6</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>All together the creation of this game was not difficult. With some more time spent on adding sounds, animations to monsters, and general fluff you would have a sweet fun game.</p>
<p>If you or your clients need any help, feel free to contact our <a href="http://www.woveninteractive.com">interactive agency</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://woveninteractive.net/2009/04/side-scrolling-fish-swim-game-with-ape-physics-engine/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Twitter in Flash &#8211; Getting Past the SecurityErrorEvent</title>
		<link>http://woveninteractive.net/2009/02/twitter-in-flash-getting-past-the-securityerrorevent/</link>
		<comments>http://woveninteractive.net/2009/02/twitter-in-flash-getting-past-the-securityerrorevent/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 22:34:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter in Flash AS3]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SecurityErrorEvent]]></category>
		<category><![CDATA[Website Design]]></category>

		<guid isPermaLink="false">http://woveninteractive.net/?p=45</guid>
		<description><![CDATA[
We took on a small task today to add our latest Tweet's to the homepage of our site. We decided to go with the library twitterscript. It's a nice simple wrapper around the twitter API and allows you to quickly create your app. All this with one catch. Out of the box it only works [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.twitter.com/wovenatl"><img src="http://woveninteractive.net/wp-content/uploads/2009/02/woven-interactive-twitter1.jpg" alt="woven-interactive-twitter" title="woven-interactive-twitter" width="475" class="alignnone size-full wp-image-51" /></a></p>
<p>We took on a small task today to add our latest Tweet's to the homepage of our site. We decided to go with the library <a href="http://code.google.com/p/twitterscript/source/checkout">twitterscript</a>. It's a nice simple wrapper around the twitter API and allows you to quickly create your app. All this with one catch. Out of the box it only works locally due to twitters cross domain policy. </p>
<p>To get around this we had to make a few tweaks to the code and add a proxy file. </p>
<p>Twitter.as - Changed lines 55 - 98</p>
<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showCodeTxt('actionscript-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const LOAD_FRIENDS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/friends/$userId.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const LOAD_FRIENDS_TIMELINE_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/friends_timeline/$userId.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const PUBLIC_TIMELINE_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/public_timeline.xml"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const LOAD_USER_TIMELINE_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/user_timeline/$userId.xml"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const FOLLOW_USER_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=friendships/create/$userId.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SET_STATUS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/update.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SHOW_STATUS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/show/$id.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const REPLIES_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/replies.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const DESTROY_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/destroy/$id.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const FOLLOWERS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/followers.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const FEATURED_USERS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=statuses/featured.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const GET_DIRECT_MSGS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=direct_messages.xml?"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SEND_DIRECT_MSG_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=direct_messages/new.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SEARCH_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?sd=search&amp;path=search.atom?"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const VERIFY_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=account/verify_credentials.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const UPDATE_LOCATON_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=account/update_location"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const RATE_LIMIT_STATUS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=account/rate_limit_status.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const END_SESSION_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=account/end_session.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const GET_SENT_DIRECT_MESSAGE_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=direct_messages/sent.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SHOW_INFO_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=users/show/${id}.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const FRIENDS_IDS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=friends/ids/${id}.xml"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const FOLLOWERS_IDS_URL:<span style="color: #0066CC;">String</span> = </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"/proxy.php?path=followers/ids/${id}.xml"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Then adding a proxy.php file to our server:</p>
<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showCodeTxt('actionscript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// PHP Proxy</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//for higher security just put the url you want here or build </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//your url with GET or POST parameters. Not the best idea to </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//pass the entire url</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//make sure we're using http</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$url = <span style="color: #ff0000;">'http://'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>isset<span style="color: #66cc66;">&#40;</span>$_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sd'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; $_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sd'</span><span style="color: #66cc66;">&#93;</span> != <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $url .= $_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sd'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">'.'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//ensure only twitter domains are used</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$url .= <span style="color: #ff0000;">'twitter.com/'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>isset<span style="color: #66cc66;">&#40;</span>$_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; $_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span> != <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $url .= $_GET<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//you can change this to set mimeType via parameters, but </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//chances are you want xml</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$mimeType = <span style="color: #ff0000;">'application/xml'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$response = file_get_contents<span style="color: #66cc66;">&#40;</span>$url<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>$mimeType != <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; header<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Content-Type: "</span>.$mimeType<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo $response;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Do this and you'll be rid of the Security Errors and able to integrate Twitter into your Flash site.</p>
<p>If you or your clients need any help, feel free to contact our <a href="http://www.woveninteractive.com/#/connect">interactive agency</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://woveninteractive.net/2009/02/twitter-in-flash-getting-past-the-securityerrorevent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Look Mom No Javascript : Google Analytics Flash Event Tracking</title>
		<link>http://woveninteractive.net/2009/02/look-mom-no-javascript-google-analytics-flash-event-tracking/</link>
		<comments>http://woveninteractive.net/2009/02/look-mom-no-javascript-google-analytics-flash-event-tracking/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 18:27:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash Actionscript]]></category>
		<category><![CDATA[Flash Analytics]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash Event Tracking]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Interactive Agency]]></category>
		<category><![CDATA[Page Load Times]]></category>

		<guid isPermaLink="false">http://woveninteractive.net/?p=30</guid>
		<description><![CDATA[

If you have not heard already, Google has a new tool for tracking Flash Analytics. Unlike the first version we tested a year ago, this new code base requires no javascript to implement. Why is this important? 
Here is the scenario:
I create a killer Flash widget and would like to track how users interact with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.woveninteractive.com"><img src="http://woveninteractive.net/wp-content/uploads/2009/02/google-analytics-screenshot.jpg" alt="google-analytics-screenshot" title="google-analytics-screenshot" width="475" class="alignnone size-full wp-image-35" /></a><br />
</br><br />
If you have not heard already, Google has a new tool for <a href="http://code.google.com/p/gaforflash/">tracking Flash Analytics</a>. Unlike the first version we tested a year ago, this new code base requires no javascript to implement. Why is this important? </p>
<p>Here is the scenario:</p>
<p>I create a killer <a href="http://www.ilovenapoleondynamite.com/">Flash widget</a> and would like to track how users interact with it. If the widget is only on my site then a javascript / flash tracking solution works great. But, if I want to spread it virally and still track my results I can't rely on a javascript solution.</p>
<p>This is where google event tracking enters the picture: <a href="http://code.google.com/p/gaforflash/">gaforflash</a></p>
<p>While you can use this to track page views button clicks etc you can also get creative and track much much more.</p>
<p>Our <a href="http://woveninteractive.com/">Interactive Agency</a> decided to track Flash page load times. This would allow us to determine if the average user was waiting too long to view a page. Example code below:</p>
<p><img src="http://woveninteractive.net/wp-content/uploads/2009/02/google-analytics-event-tracking.jpg" alt="google-analytics-event-tracking" title="google-analytics-event-tracking" width="475" class="alignnone size-full wp-image-37" /></p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showCodeTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_controller.<span style="color: #006600;">mainLoadTimer</span>  = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">time</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showCodeTxt('actionscript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> pageReady<span style="color: #66cc66;">&#40;</span>val:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; _pageReadyTime = val;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> currentPage:<span style="color: #0066CC;">String</span> = Gaia.<span style="color: #006600;">api</span>.<span style="color: #006600;">getCurrentBranch</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> timeToLoad:<span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>_pageReadyTime - _mainLoadTimer<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>initalPageLoad<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; initalPageLoad = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Page Load Times"</span>, <span style="color: #ff0000;">"Initial Load"</span>, currentPage, timeToLoad<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tracker.<span style="color: #006600;">trackEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Page Load Times"</span>, <span style="color: #ff0000;">"Site Browsing"</span>, currentPage,timeToLoad<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This can also be done to track video start times as seen in the example by <a href="http://www.insideria.com/2009/02/using-google-analytics-within.html">Matthew McNeely</a>.</p>
<p>Before you can view the event tracking data in your Google Analytics account you will need your profile to be white-listed by Google. Get started today even if you are not yet white-listed as your account will retroactively display the results from when you first implemented the code. </p>
<p>If you or your clients need any help getting started feel free to contact our <a href="http://www.woveninteractive.com/#/connect">interactive agency</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://woveninteractive.net/2009/02/look-mom-no-javascript-google-analytics-flash-event-tracking/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
