<?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"
	>

<channel>
	<title>CODE ENDEAVOR</title>
	<atom:link href="http://codeendeavor.com/feed" rel="self" type="application/rss+xml" />
	<link>http://codeendeavor.com</link>
	<description>AARON SMITH'S CODE ENDEAVOR</description>
	<pubDate>Tue, 09 Mar 2010 05:24:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<item>
		<title>Removing Classes from MXMLC Link Reports</title>
		<link>http://codeendeavor.com/archives/826</link>
		<comments>http://codeendeavor.com/archives/826#comments</comments>
		<pubDate>Tue, 09 Mar 2010 05:24:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=826</guid>
		<description><![CDATA[I started creating swcs for guttershark and ran into an annoying problem that I&#8217;m sure others have run into. In order to exclude classes from a swc you have to generate a link report from mxmlc. Then re-create the swc but tell mxmlc to load that report file and use it as the source for [...]]]></description>
			<content:encoded><![CDATA[<p>I started creating swcs for guttershark and ran into an annoying problem that I&#8217;m sure others have run into. In order to exclude classes from a swc you have to generate a link report from mxmlc. Then re-create the swc but tell mxmlc to load that report file and use it as the source for files to exclude.</p>
<p>That&#8217;s great and all, but the link report is usually huge, especially if you&#8217;re code links against flash components or flvplayback code. So in order to include only the classes you want (like only guttershark classes), I was starting to poke through the link report, and remove the guttershark classes.</p>
<p>Just to get this straight. MXMLC uses the link report as a source for actionscript classes to exclude from  the swc. So if I want only the guttershark classes, you have to go into the link report and remove any guttershark class. The GS classes won&#8217;t be in the link report, which will cause them to be included in the swc.</p>
<p>Pretty simple; either poke through it and remove classes manually or try to write regular expressions to match only GS files. Then you think, &#8220;shit, this is a huge pain in the ass, and I&#8217;m going to waste a ton of time every time I need to update this link report.&#8221;</p>
<p>Here&#8217;s what I&#8217;m getting to: a python script to do it for you. This is the general usage sequence:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #666666; font-style: italic;">#...generate swc and link report with compc...</span>
python swc_link_report_remove.py -l report.xml -m <span style="color: #ff0000;">&quot;/Users/aaronsmith/Development/git/guttershark&quot;</span> -o gsreport.xml
<span style="color: #666666; font-style: italic;">#...generate swc passing gsreport.xml for -load-externs to compc...</span></pre></div></div>

<p>Here&#8217;s what the script does:</p>
<ul>
<li>Load the original report.xml and parse it</li>
<li>Loop through each script item</li>
<li>If the script name attribute matches against the -m property, skip the item.</li>
<li>Write out the new link report file.</li>
</ul>
<p>This is a much faster way to remove the classes you actually want included in the swc. I don&#8217;t use mxmlc or compc all that much, so maybe there is any easier way but the documentation certainly doesn&#8217;t outline any.</p>
<p>I&#8217;m on a mac, and you&#8217;ll need to install &#8220;lxml&#8221; for python.</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> easy_install lxml</pre></div></div>

<p><a href="http://codeendeavor.com/downloads/swc_link_report_remove.py">Here&#8217;s the script.</a> Put it somewhere in your path for easy access and make sure it&#8217;s executable. Even if this isn&#8217;t exactly what you need, it&#8217;s a good starting point for scripting updates to the link reports.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/826/feed</wfw:commentRss>
		</item>
		<item>
		<title>Guttershark Updates</title>
		<link>http://codeendeavor.com/archives/821</link>
		<comments>http://codeendeavor.com/archives/821#comments</comments>
		<pubDate>Mon, 08 Mar 2010 08:13:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=821</guid>
		<description><![CDATA[I finished the service layer updates. I ended up re-writing the flash remoting classes, and mostly re-writing the soap classes. There are a bunch more examples in the repository for working with http, remoting, and soap. It&#8217;s really good stuff and simplifies those layers even more than what&#8217;s in the AS3 api.
You may also notice [...]]]></description>
			<content:encoded><![CDATA[<p>I finished the service layer updates. I ended up re-writing the flash remoting classes, and mostly re-writing the soap classes. There are a bunch more examples in the repository for working with http, remoting, and soap. It&#8217;s really good stuff and simplifies those layers even more than what&#8217;s in the AS3 api.</p>
<p>You may also notice one other update and it may or may not piss you off; I re-organized the package structure. All the examples have been updated. And I&#8217;ve been combing through the documentation again making updates. Mostly nit picky things. And I&#8217;ve been taking out examples from the documentation in favor of putting a note that states the examples are in the repository. It&#8217;s easier to maintain those examples, rather than hard coded examples in the source code.</p>
<p><a href="http://codeendeavor.com/docs/gs/">docs</a></p>
<p><a href="http://gitweb.codeendeavor.com/?p=guttershark.git;a=summary">repo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/821/feed</wfw:commentRss>
		</item>
		<item>
		<title>Guttershark Service Abstraction Updates</title>
		<link>http://codeendeavor.com/archives/814</link>
		<comments>http://codeendeavor.com/archives/814#comments</comments>
		<pubDate>Sat, 06 Mar 2010 04:16:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=814</guid>
		<description><![CDATA[I&#8217;m working on revamping the service abstractions in Guttershark. I&#8217;ll be completely removing the ServiceManager in favor of using a class directly (like HTTPCall, SoapService, etc). I&#8217;ve got the http stuff done, and need to update soap and remoting. The http code is the most drastically changed. The soap and remoting code won&#8217;t change too [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on revamping the service abstractions in Guttershark. I&#8217;ll be completely removing the ServiceManager in favor of using a class directly (like HTTPCall, SoapService, etc). I&#8217;ve got the http stuff done, and need to update soap and remoting. The http code is the most drastically changed. The soap and remoting code won&#8217;t change too much.</p>
<p>I&#8217;ve got a couple examples in the repo for the new HTTPCall class. But in short, here&#8217;s how you use it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">core</span>.<span style="color: #006600;">DocumentController</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">service</span>.<span style="color: #006600;">http</span>.<span style="color: #006600;">HTTPCall</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">service</span>.<span style="color: #006600;">http</span>.<span style="color: #006600;">HTTPCallResponseFormat</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">service</span>.<span style="color: #006600;">http</span>.<span style="color: #006600;">HTTPCallResult</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> DocumentController
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> hc:HTTPCall;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> setupComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			hc=<span style="color: #000000; font-weight: bold;">new</span> HTTPCall<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://www.google.com/&quot;</span><span style="color: #66cc66;">&#41;</span>;
			hc.<span style="color: #006600;">responseFormat</span>=HTTPCallResponseFormat.<span style="color: #0066CC;">TEXT</span>;
			hc.<span style="color: #006600;">setCallbacks</span><span style="color: #66cc66;">&#40;</span>onResult<span style="color: #66cc66;">&#41;</span>;
			hc.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> onResult<span style="color: #66cc66;">&#40;</span>r:HTTPCallResult<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>r.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>And if you look through the <a href="http://codeendeavor.com/docs/gs/gs/service/http/HTTPCall.html">docs</a>, it supports a bunch of other stuff - retries, timeouts, more response formats than URLLoaderResponseFormat, and you can optionally set callbacks instead of using .addEventListener. Which is a nice alternative that allows you to setup the handlers you need in one line of code. Of course you can still opt in to using .addEventListener.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/814/feed</wfw:commentRss>
		</item>
		<item>
		<title>Coda Plugin for Gity</title>
		<link>http://codeendeavor.com/archives/811</link>
		<comments>http://codeendeavor.com/archives/811#comments</comments>
		<pubDate>Tue, 02 Mar 2010 09:07:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Gity]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=811</guid>
		<description><![CDATA[Randomly came across this plugin for Coda which opens your project in Gity. Check it out.
]]></description>
			<content:encoded><![CDATA[<p>Randomly came across this plugin for Coda which opens your project in Gity. <a href="http://github.com/bobthecow/Gity.codaplugin">Check it out</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/811/feed</wfw:commentRss>
		</item>
		<item>
		<title>New TextAttributes Class in Guttershark</title>
		<link>http://codeendeavor.com/archives/803</link>
		<comments>http://codeendeavor.com/archives/803#comments</comments>
		<pubDate>Tue, 23 Feb 2010 09:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=803</guid>
		<description><![CDATA[I added this new class called TextAttributes. It simplifies setting the right properties on a text field for text formats, stylesheets, a few other things, and the model has helpers to simplify it even more.
Here&#8217;s a model xml file:

&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;model&#62;
&#160;
	&#60;assets&#62;
		&#60;asset libraryName=&#34;fonts&#34; source=&#34;fonts.swf&#34; preload=&#34;true&#34; /&#62;
	&#60;/assets&#62;
&#160;
	&#60;fonts&#62;
		&#60;font libraryName=&#34;LucidaGrandeBold&#34; /&#62;
		&#60;font libraryName=&#34;LucidaGrandeRegular&#34; /&#62;
	&#60;/fonts&#62;
&#160;
	&#60;stylesheets&#62;
		&#60;stylesheet id=&#34;style1&#34;&#62;
			&#60;![CDATA[
			.body {
				color:#000000;
				font:LucidaGrandeBold;
			}
			.test {
				color:#ff0066;
			}
			]]&#62;
		&#60;/stylesheet&#62;
	&#60;/stylesheets&#62;
&#160;
	&#60;textAttributes&#62;
		&#60;attribute id=&#34;attr1&#34; styleSheetId='style1' wrapInBodySpan=&#34;true&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>I added this new class called TextAttributes. It simplifies setting the right properties on a text field for text formats, stylesheets, a few other things, and the model has helpers to simplify it even more.</p>
<p>Here&#8217;s a model xml file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;model<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;assets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">libraryName</span>=<span style="color: #ff0000;">&quot;fonts&quot;</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;fonts.swf&quot;</span> <span style="color: #000066;">preload</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/assets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;fonts<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">libraryName</span>=<span style="color: #ff0000;">&quot;LucidaGrandeBold&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;font</span> <span style="color: #000066;">libraryName</span>=<span style="color: #ff0000;">&quot;LucidaGrandeRegular&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/fonts<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;stylesheets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;stylesheet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;style1&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">			.body {</span>
<span style="color: #339933;">				color:#000000;</span>
<span style="color: #339933;">				font:LucidaGrandeBold;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">			.test {</span>
<span style="color: #339933;">				color:#ff0066;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">			]]&gt;</span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/stylesheet<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/stylesheets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;textAttributes<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;attribute</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;attr1&quot;</span> <span style="color: #000066;">styleSheetId</span>=<span style="color: #ff0000;">'style1'</span> <span style="color: #000066;">wrapInBodySpan</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">antiAliasType</span>=<span style="color: #ff0000;">&quot;advanced&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/textAttributes<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/model<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>Simple enough, the model defines fonts, stylesheets, and now the additional textAttributes can be defined.</p>
<p>Here&#8217;s a guttershark document controller showing the use of text attributes.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">core</span>.<span style="color: #006600;">DocumentController</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">core</span>.<span style="color: #006600;">Preloader</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> DocumentController
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> t1:<span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> t2:<span style="color: #0066CC;">TextField</span>;
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> flashvarsForStandalone<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#123;</span>model:<span style="color: #ff0000;">&quot;model.xml&quot;</span><span style="color: #66cc66;">&#125;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> startPreload<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			preloader=<span style="color: #000000; font-weight: bold;">new</span> Preloader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			preloader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,onPreloadComplete<span style="color: #66cc66;">&#41;</span>;
			preloader.<span style="color: #006600;">addItems</span><span style="color: #66cc66;">&#40;</span>model.<span style="color: #006600;">getAssetsForPreload</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			preloader.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> onPreloadComplete<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span>.<span style="color: #006600;">onPreloadComplete</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span><span style="color: #66cc66;">&#41;</span>;
			model.<span style="color: #006600;">getTextAttributeById</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;attr1&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span>t1,t2<span style="color: #66cc66;">&#41;</span>;
                        t1.<span style="color: #0066CC;">htmlText</span> = <span style="color: #ff0000;">&quot;&lt;span class='body'&gt;hello &lt;span class='test'&gt;world&lt;/span&gt;&lt;/span&gt;&quot;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The Model has a new method called getTextAttributeById which will give you an instance of a TextAttributes class, which coincidentally contains a method to apply it to any number of text fields.</p>
<p>The TextAttributes class can be used by itself, but having a helper method on the Model just simplifies defining all that information in XML.</p>
<p>There&#8217;s another example in the guttershark repo.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/803/feed</wfw:commentRss>
		</item>
		<item>
		<title>Tracking With Guttershark</title>
		<link>http://codeendeavor.com/archives/790</link>
		<comments>http://codeendeavor.com/archives/790#comments</comments>
		<pubDate>Sun, 21 Feb 2010 01:13:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=790</guid>
		<description><![CDATA[I thought I&#8217;d take a minute to show how I implement tracking with guttershark. I&#8217;ve used this a lot and it always works. I wrote this tracking manager a while ago with the intentions of figuring out these problems:

Provide some sort of assertions mechanism so the manager will first assert some condition, then fire or [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d take a minute to show how I implement tracking with guttershark. I&#8217;ve used this a lot and it always works. I wrote this tracking manager a while ago with the intentions of figuring out these problems:</p>
<ul>
<li>Provide some sort of assertions mechanism so the manager will first assert some condition, then fire or not fire.</li>
<li>Fire different information based on if the assertion is true or false.</li>
<li>Provide dynamic data in combination with tracking information from xml. Like the index of an image let&#8217;s say.</li>
</ul>
<p>First thing&#8217;s first, here&#8217;s an example xml snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tag1&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tag2&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>Currently the tracking manager only supports webtrends and hitbox. I haven&#8217;t written any projects that require anything else yet. There are hooks in the tracking manager for ganalytics, omniture, and atlas; so anyone else could implement it and share it with me to be put in GS.</p>
<p>The tracking manager will fire whatever tracking type you have defined in a track node. Here&#8217;s an example xml file with both webtrends and hitbox:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tag1&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;hitbox<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;lpos<span style="font-weight: bold; color: black;">&gt;</span></span></span>asdf<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/lpos<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;lid<span style="font-weight: bold; color: black;">&gt;</span></span></span>ghjk<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/lid<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/hitbox<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tag2&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>So the tracking node &#8220;tag1&#8243; would fire both webtrends and hitbox. This also shows that depending on the tracking type, the tracking manager will parse the xml differently. </p>
<p>Let&#8217;s take the webtrends tag for example. The tracking manager will split the content on a comma (&#8221;,&#8221;), and use index 0 as &#8220;dcsuri&#8221;, index 1 as &#8220;ti&#8221;, and index 2 as &#8220;cg_n&#8221;. Those are webtrends variables passed to their dcsMultiTrack function.</p>
<p>So let&#8217;s take a look at getting this to fire. Here&#8217;s a document class that would do it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">core</span>.<span style="color: #006600;">DocumentController</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">core</span>.<span style="color: #006600;">Preloader</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">util</span>.<span style="color: #006600;">MathUtils</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> DocumentController
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> clip:<span style="color: #0066CC;">MovieClip</span>;
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> flashvarsForStandalone<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span>
		<span style="color: #66cc66;">&#123;</span>
                        <span style="color: #808080; font-style: italic;">//the model file contains the tracking.xml file asset</span>
			<span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#123;</span>model:<span style="color: #ff0000;">&quot;model.xml&quot;</span><span style="color: #66cc66;">&#125;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> onModelReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			preloader=<span style="color: #000000; font-weight: bold;">new</span> Preloader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #808080; font-style: italic;">//preloader will load the tracking.xml asset</span>
			preloader.<span style="color: #006600;">addItems</span><span style="color: #66cc66;">&#40;</span>model.<span style="color: #006600;">getAssetsForPreload</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			preloader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,onPreloadComplete<span style="color: #66cc66;">&#41;</span>;
			preloader.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> initTracking<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span>.<span style="color: #006600;">initTracking</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//tracking is initialized in DocumentController</span>
                        <span style="color: #808080; font-style: italic;">//tell the tracking manager to fire the &quot;tag1&quot; track when clip is clicked.</span>
			tracking.<span style="color: #006600;">register</span><span style="color: #66cc66;">&#40;</span>clip,MouseEvent.<span style="color: #006600;">CLICK</span>,<span style="color: #ff0000;">&quot;tag1&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Because this is using the guttershark framework there&#8217;s one hidden thing. Guttershark will load a model.xml file which contains our tracking.xml file asset. </p>
<p>Here&#8217;s what that model.xml file looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;model<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;assets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">libraryName</span>=<span style="color: #ff0000;">&quot;tracking&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;tracking.xml&quot;</span> <span style="color: #000066;">preload</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/assets<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/model<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>All the model xml does is define a tracking asset which is an xml file. The guttershark document controller will find that asset, and initialize a tracking manager for us. It&#8217;s actually really straightforward. All the DocumentController does is expose hooks and sets up some default things that I use all the time. Read the source for DocumentController for more info. Anyway, back to the tracking.</p>
<p>With everything that we&#8217;ve setup so far. A tracking call would be fired for &#8220;tag1&#8243; when you click on the  movie clip. This is where it starts to get interesting.</p>
<p>Let&#8217;s say we didn&#8217;t want the tracking to fire if clip is disabled. Here&#8217;s how you can do that:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">...
<span style="color: #006600;">override</span> protected <span style="color: #000000; font-weight: bold;">function</span> initTracking<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">initTracking</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> options:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span>
        assertProp:<span style="color: #ff0000;">&quot;enabled&quot;</span>
    <span style="color: #66cc66;">&#125;</span>;
    tracking.<span style="color: #006600;">register</span><span style="color: #66cc66;">&#40;</span>clip,MouseEvent.<span style="color: #006600;">CLICK</span>,<span style="color: #ff0000;">&quot;tag1&quot;</span>,options<span style="color: #66cc66;">&#41;</span>;
    clip.<span style="color: #0066CC;">enabled</span>=<span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
...</pre></div></div>

<p>The tracking manager internally will end up using &#8220;if(clip["enabled"]) fire()&#8221;. The tracking manager can also use a method:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">...
<span style="color: #006600;">override</span> protected <span style="color: #000000; font-weight: bold;">function</span> initTracking<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">initTracking</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> options:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span>
        assertMethod:shouldFire
    <span style="color: #66cc66;">&#125;</span>;
    tracking.<span style="color: #006600;">register</span><span style="color: #66cc66;">&#40;</span>clip,MouseEvent.<span style="color: #006600;">CLICK</span>,<span style="color: #ff0000;">&quot;tag1&quot;</span>,options<span style="color: #66cc66;">&#41;</span>;
    clip.<span style="color: #0066CC;">enabled</span>=<span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> shouldFire<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>clip.<span style="color: #006600;">alpha</span> <span style="color: #66cc66;">&gt;</span> .<span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #000000; font-weight: bold;">true</span> : <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
...</pre></div></div>

<p>With that update, the tracking event would only fire if the clip&#8217;s alpha is greater than .25.</p>
<p>That covers some of the basic assertions.</p>
<p>What if we wanted to choose which tag to fire depending on if the assertion is true or false? First let&#8217;s make an update to the xml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	...
        <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;clipWasShown&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;track</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;clipWasHidden&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>tag1,tag2,tag3<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/webtrends<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/track<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	...
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/tracking<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>And here&#8217;s how I&#8217;d update the actionscript to accommodate this.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">...
<span style="color: #006600;">override</span> protected <span style="color: #000000; font-weight: bold;">function</span> initTracking<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">initTracking</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> options:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span>
        assertProp:<span style="color: #ff0000;">&quot;visible&quot;</span>,
        whenTrue:<span style="color: #ff0000;">&quot;clipWasShown&quot;</span>,
        whenFalse:<span style="color: #ff0000;">&quot;clipWasHidden&quot;</span>
    <span style="color: #66cc66;">&#125;</span>;
    tracking.<span style="color: #006600;">register</span><span style="color: #66cc66;">&#40;</span>clip,MouseEvent.<span style="color: #006600;">CLICK</span>,<span style="color: #000000; font-weight: bold;">null</span>,options<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
...</pre></div></div>

<p>That&#8217;s really just another useful option in the tracking manager arsenal.</p>
<p>Now for the last problem, dynamic data. Let&#8217;s say we wanted to include the index of some slideshow, which indicates which picture their looking at. And let&#8217;s say we want it appended to the &#8220;cg_n&#8221; variable that get&#8217;s sent to webtrends.</p>
<p>Here&#8217;s how you can implement dynamic data:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">...
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">index</span>:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> next<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">index</span>++;
    render<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> prev<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    index--;
    render<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
override protected <span style="color: #000000; font-weight: bold;">function</span> initTracking<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">initTracking</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> options:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span>
         dynamicData:slideShowIndex
    <span style="color: #66cc66;">&#125;</span>;
    tracking.<span style="color: #006600;">register</span><span style="color: #66cc66;">&#40;</span>clip,MouseEvent.<span style="color: #006600;">CLICK</span>,<span style="color: #ff0000;">&quot;tag1&quot;</span>,options<span style="color: #66cc66;">&#41;</span>;
    clip.<span style="color: #0066CC;">enabled</span>=<span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> slideShowIndex<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #66cc66;">&#125;</span>
...</pre></div></div>

<p>So in this case, the tracking manager expects an array for the &#8220;dynamic data&#8221; for webtrends. And will append whatever is in the array to the tags from xml before firing.</p>
<p>The dynamic data just happens to be implemented this way for webtrends. But if it&#8217;s a different tracking type you would return whatever the tracking manager is expecting. So for example, the &#8220;hitbox&#8221; tracking would require a function like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> slideShowIndex<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#123;</span>lpos:<span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#125;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>That&#8217;s pretty much it. As mentioned, I don&#8217;t have omniture, ganalytics, or atlas implemented, but there are hooks in the tracking manager. So if anyone out there needs to implement then please share.</p>
<p>I like using the tracking manager this way because it limits the amount of code I have to write to actually fire tracking. And keeps the real tracking tags out of your code.</p>
<p>There&#8217;s one other thing to mention - whenever you&#8217;re working with someone from an analytics department who is creating the tags for you. Make sure they know to always put dynamic data at the end of the tags. It&#8217;s easier to implement ;)</p>
<p>There are a couple examples in the guttershark repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/790/feed</wfw:commentRss>
		</item>
		<item>
		<title>New KeyHandler Class</title>
		<link>http://codeendeavor.com/archives/783</link>
		<comments>http://codeendeavor.com/archives/783#comments</comments>
		<pubDate>Tue, 16 Feb 2010 21:53:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=783</guid>
		<description><![CDATA[I&#8217;ve added a new class to replace the KeyManager. The key manager was nice but somewhat complicated internally. I&#8217;m replacing it with this new key handler class - It&#8217;s similar to the key manager except that it will only handle one key event per instance VS the key manager which would manage every key event [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added a new class to replace the KeyManager. The key manager was nice but somewhat complicated internally. I&#8217;m replacing it with this new key handler class - It&#8217;s similar to the key manager except that it will only handle one key event per instance VS the key manager which would manage every key event you wanted.</p>
<p>I added a new feature called auto target, which will enable, or disable the key handler when the target is removed or added to the stage.</p>
<p>Here&#8217;s how you use it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">util</span>.<span style="color: #006600;">KeyHandler</span>;
	<span style="color: #0066CC;">import</span> gs.<span style="color: #006600;">util</span>.<span style="color: #006600;">StageRef</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">setTimeout</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mc:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> kh:KeyHandler;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> kh2:KeyHandler;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> kh3:KeyHandler;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> kh4:KeyHandler;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//the stage ref needs to be set somewhere</span>
			StageRef.<span style="color: #0066CC;">stage</span>=<span style="color: #0066CC;">stage</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//create key handlers.</span>
			kh=<span style="color: #000000; font-weight: bold;">new</span> KeyHandler<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SHIFT+M&quot;</span>,onShiftM<span style="color: #66cc66;">&#41;</span>;
			kh2=<span style="color: #000000; font-weight: bold;">new</span> KeyHandler<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;UP&quot;</span>,onUp<span style="color: #66cc66;">&#41;</span>;
			kh3=<span style="color: #000000; font-weight: bold;">new</span> KeyHandler<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;f&quot;</span>,onLetter<span style="color: #66cc66;">&#41;</span>;
			kh4=<span style="color: #000000; font-weight: bold;">new</span> KeyHandler<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;as&quot;</span>,onSequence<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//auto target example (enabled/disabled depending on if the target is on the stage)</span>
			<span style="color: #808080; font-style: italic;">//the &quot;kh&quot; keyHandler won't work when the clip is off the stage.</span>
			kh.<span style="color: #006600;">autoTarget</span>=mc;
			setTimeout<span style="color: #66cc66;">&#40;</span>removeChild,<span style="color: #cc66cc;">2000</span>,mc<span style="color: #66cc66;">&#41;</span>;
			setTimeout<span style="color: #66cc66;">&#40;</span>addChild,<span style="color: #cc66cc;">4000</span>,mc<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onSequence<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;sequence as&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onLetter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;letter f&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onShiftM<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SHIFT+M&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;UP&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>There&#8217;s a functioning example in the guttershark repo.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/783/feed</wfw:commentRss>
		</item>
		<item>
		<title>More Guttershark Updates</title>
		<link>http://codeendeavor.com/archives/766</link>
		<comments>http://codeendeavor.com/archives/766#comments</comments>
		<pubDate>Sun, 14 Feb 2010 23:48:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[Guttershark]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=766</guid>
		<description><![CDATA[Recently I put up some updates to guttershark - they sucked, so I&#8217;ve got another update. I was getting tired of having to include 90K for any swf that uses GS. So I went through and decoupled quite a bit.
Primarily it was all the singletons that were included. Originally, when I wrote the first version [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I put up some updates to guttershark - they sucked, so I&#8217;ve got another update. I was getting tired of having to include 90K for any swf that uses GS. So I went through and decoupled quite a bit.</p>
<p>Primarily it was all the singletons that were included. Originally, when I wrote the first version of GS I used all the singletons for performance and speed, but for how often some of those utilities are used it really doesn&#8217;t matter. And if you use FDT or Flex Builder, importing everything you need will be auto-completed anyways. So who cares!</p>
<p>The first version of GS included a couple classes called CoreSprite, and CoreClip - they included properties so that you&#8217;d always have access to a bunch of stuff, like a Model for instance. Instead of that, your class should create it&#8217;s own model, save it, and import it in any class that uses it.</p>
<p>You can still create your own base classes that contain properties you use all the time, but I&#8217;m not going to tell you what you need and what you don&#8217;t need; this is one of the reasons why GS would include everything if you subclassed either CoreSprite or CoreClip. So for any project you have, write your own base classes that included references to the things you need; that&#8217;s what I do.</p>
<p>Here&#8217;s a contrived example.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">class</span> Main
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> model:Model;
    <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
         model = <span style="color: #000000; font-weight: bold;">new</span> Model<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
         Model.<span style="color: #0066CC;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;main&quot;</span>,model<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> AnotherClass
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> model:Model;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AnotherClass
    <span style="color: #66cc66;">&#123;</span>
        model = Model.<span style="color: #0066CC;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;main&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>There are a number other classes that have this type of functionality on it. You can find them in the docs. Anyway, I&#8217;m much happier with this. Generally a shell swf will end up being around 35K.</p>
<p>There are a <a href="http://gitweb.codeendeavor.com/?p=guttershark.git;a=tree;f=examples;h=e05df781297bda4eff31fa900e975c82b5509fbb;hb=2cc2d954e6d78922e68409bdf04da9a2cc52d985">crap ton of examples</a> in the repository. Make sure to check those out, you might see how awesome GS is and how much time it&#8217;ll save you.</p>
<p>If you wrote anything with GS in V1 or V2, you won&#8217;t be able to swap it out for GS3 without making some updates. The most notable things I changed:</p>
<ul>
<li>Took out CoreClip and CoreSprite. There&#8217;s GSClip or GSSprite now, but only fixes null stage references.</li>
<li>Most utility classes have static methods on them instead of singletons.</li>
<li>AssetManager is static</li>
<li>Re-ordered method parameters on the LayoutManager to use &#8230;rest style parameters</li>
<li>There&#8217;s a new DocumentController class which is simpler.</li>
<li>Added a new TextAttributes class (gs.utils.TextAttributes). And added new model functionality to simplify setting text attributes on text fields. Like stylesheets, textformats, etc. Now it&#8217;s a one liner to set text attributes.</li>
</ul>
<p>Additionally, I&#8217;ve updated the repositories on my <a href="http://gitweb.codeendeavor.com/">gitweb</a> page. The <a href="http://gitweb.codeendeavor.com/?p=guttershark.git;a=summary">guttershark</a> repo is the latest version, and I&#8217;ve updated the <a href="http://codeendeavor.com/docs/gs">docs</a>. You won&#8217;t need to look for gs2 docs or the gs2 repo anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/766/feed</wfw:commentRss>
		</item>
		<item>
		<title>Elsware: Transactional Python Deployments</title>
		<link>http://codeendeavor.com/archives/757</link>
		<comments>http://codeendeavor.com/archives/757#comments</comments>
		<pubDate>Wed, 03 Feb 2010 04:57:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Elsware]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=757</guid>
		<description><![CDATA[I built this transactional python deployment system a while back. I didn&#8217;t ever mention it because I was waiting to add a few things. But now that I&#8217;m looking at it again, I&#8217;m remembering that it&#8217;s actually pretty cool and some people might like it. Or maybe want to use it as inspiration to create [...]]]></description>
			<content:encoded><![CDATA[<p>I built this transactional python deployment system a while back. I didn&#8217;t ever mention it because I was waiting to add a few things. But now that I&#8217;m looking at it again, I&#8217;m remembering that it&#8217;s actually pretty cool and some people might like it. Or maybe want to use it as inspiration to create the next best deployment system.</p>
<p>Elsware is a generic deployment system that&#8217;s meant to be &#8220;hooked&#8221; into, and has hooks for transactions.</p>
<p>The initial reason I built this, was for Django. If any of you have used Django you know it uses a &#8220;settings&#8221; file to describe things about the application. I wanted to be able to keep some information in that settings file so I could type &#8220;djangoadmin.py deploy &#8217;somewhere&#8217;&#8221;. And it would do it for me.</p>
<p>I didn&#8217;t ever get all the way there; as I was writing it it ended up being a lot better than I had expected. So I was writing support for a bunch of stuff - essentially built in &#8220;actions&#8221;.</p>
<p>I&#8217;m not going to explain too much technical details, I&#8217;ve got some documentation written, and the source code is on gitweb; the docs are ok, but the code is badass. Here&#8217;s a <a href="http://gitweb.codeendeavor.com/?p=elsware.git;a=blob;f=bin/config.py;h=9612c9fa0cb454378cb085cf488833837a2b25f7;hb=3461bd16ca9b7a126817ca315c2a4670834b8f6d">good example</a> of how you write deployment config files</p>
<p>If you&#8217;re interested in deployment scripting, or frustrated with anything you&#8217;re using now, definitely give this a read.</p>
<p><a href="http://codeendeavor.com/elsware">docs</a><br />
<a href="http://gitweb.codeendeavor.com/?p=elsware.git;a=shortlog;h=refs/heads/master">src</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/757/feed</wfw:commentRss>
		</item>
		<item>
		<title>Any Cocoa Developers Interested In Mac Endeavor?</title>
		<link>http://codeendeavor.com/archives/699</link>
		<comments>http://codeendeavor.com/archives/699#comments</comments>
		<pubDate>Wed, 27 Jan 2010 00:33:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Mac Endeavor]]></category>

		<guid isPermaLink="false">http://codeendeavor.com/?p=699</guid>
		<description><![CDATA[I&#8217;m slowly starting to keep an eye out for people who are interested in Cocoa, interested in Mac Endeavor, or just people who are hard workers.
Mac Endeavor is in very early stages right now. I&#8217;ve only got a few applications available; slowly but surely I&#8217;m getting more maintenance and new feature requests.
I&#8217;m looking for a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m slowly starting to keep an eye out for people who are interested in Cocoa, interested in Mac Endeavor, or just people who are hard workers.</p>
<p>Mac Endeavor is in very early stages right now. I&#8217;ve only got a few applications available; slowly but surely I&#8217;m getting more maintenance and new feature requests.</p>
<p>I&#8217;m looking for a right hand man; someone who has some drive in them to be able to do extra work on the side with me to continue Mac Endeavor. It would definitely consist of helping me with maintenance, new features, and new apps.</p>
<p>This is also an opportunity for me to help you. The type of person I&#8217;m looking to work with can also contribute ideas for new applications, or even just write the new application themselves to be sold as a Mac Endeavor app. And I&#8217;m willing to help with your ideas to write new software.</p>
<p>I&#8217;m looking for someone who would be a partner. I need help :). If you know anyone, or think you might be interested. shoot me an email: aaron[at]macendeavor.com</p>
]]></content:encoded>
			<wfw:commentRss>http://codeendeavor.com/archives/699/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
