<?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>Tyrone Neill</title>
	<atom:link href="http://www.tyroneneill.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.tyroneneill.com</link>
	<description>Self-Promoting Propaganda on Flex, AS3, Flash and Music</description>
	<lastBuildDate>Wed, 01 Sep 2010 19:18:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3 Frame Accurate Player</title>
		<link>http://www.tyroneneill.com/?p=319</link>
		<comments>http://www.tyroneneill.com/?p=319#comments</comments>
		<pubDate>Tue, 24 Aug 2010 20:52:18 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[frame accurate]]></category>
		<category><![CDATA[player]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=319</guid>
		<description><![CDATA[
&#8220;Frame accurate&#8221; playback in flash 10.1 (or not so much), recently Adobe annonced &#8220;Frame accurate stepping&#8221; in side the spiffy new release though this feature did not get as much attention as the performance features for obvious reasons though it would be nieve not to realise the types of applications that could be built with [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="Frame Accurate " src="http://johndeutscher.files.wordpress.com/2009/02/image1.png" alt="" width="399" height="290" /></p>
<p>&#8220;Frame accurate&#8221; playback in flash 10.1 (or not so much), recently Adobe annonced &#8220;Frame accurate <strong>stepping</strong>&#8221; in side the spiffy new release though this feature did not get as much attention as the performance features for obvious reasons though it would be nieve not to realise the types of applications that could be built with it.</p>
<p>I may have read into the bold statement incorrectly the first time round assuming this meant we could finally build a fancy frame accurate player (HH:MM:SS:FF &#8211; SMPTE time code) and potentially create a rough cut editor leveraging the ByteArray access in the NetStream object (http://www.bytearray.org/?p=1689) but of course my dreams have been pushed to the side while trying to figure out a way to have consistant frame accuracy using the NetStream object.</p>
<h3>Some information needed to get started</h3>
<p>Two get going you will need a FMS 3.5+ server with &#8220;Smart Seeking&#8221; configured to an ON state and secondly a client that supports stepping, sadly the popular OSMF player has not integrated this yet but since it is an open source product it is &#8220;easy&#8221; enough to tear out the guts and add step capabilities or of course create your own player (no small feat for one man) by setting the <strong>inBufferSeek</strong> setting to true and calling the netstream.step() methods.</p>
<h3>Needed background information</h3>
<p>In FMS terms it is refered to as &#8220;<strong>Smart Seeking</strong>&#8220;, not sure why they have resorted to this on the server and stepping in the client but keeps you on your toes remembering all the lingo:</p>
<blockquote><p>Flash Media Server 3.5.3 and Flash Player 10.1 work together to support smart seeking in VOD streams and in live streams that have a buffer. Smart seeking uses back and forward buffers to seek without requesting data from the server. You can step forward and backward a specified number of frames. (Standard seeking flushes buffered data and asks the server to send new data based on the seek time.) Smart seeking reduces server load and improves seeking performance.</p></blockquote>
<p>This next picture shows some of my sad moments testing frame accuracy using an asset with a burnt in time code:</p>
<div id="attachment_321" class="wp-caption aligncenter" style="width: 494px"><a href="http://farm5.static.flickr.com/4094/4923062346_1480fa9932.jpg"><img class="size-full wp-image-321" title="Frame Accurate (not so much)" src="http://farm5.static.flickr.com/4094/4923062346_1480fa9932.jpg" alt="" width="484" height="282" /></a><p class="wp-caption-text">Not so frame accurate</p></div>
<p>As you can see we are not only out by a few frames but even a second, at first I initially thought my calculations were off and double/triple checked them:</p>
<p>* 24 frame/sec (film, ATSC, 2k, 4k, 6k)<br />
* 25 frame/sec (PAL (Europe, Argentina), SECAM, DVB, ATSC)<br />
* 29.97 (30 ÷ 1.001) frame/sec (NTSC American System (US, Canada, Mexico, Colombia, etc.), ATSC, PAL-M (Brazil))<br />
* 30 frame/sec (ATSC)</p>
<p>If you are not sure what framerate you currently dealing with you could always use the callback onMetadata to rerieve, frames are simply calculated on the second and therefore &#8221; framerate / 60 seconds&#8221;.</p>
<p>when building a player one thing should be thought of at all times, frame accuracy is only <strong>inside the Buffer</strong> and any action forcing the buffer to clear (seek() etc&#8230;) would ultimately cause you to lose the accuracy until the player can start sampling data from the buffer (that I am assuming on some of my discoveries), this makes true playback frame accuracy a bit of a dream.</p>
<p><img class="alignnone" src="http://go.blogs.com/photos/uncategorized/2008/08/02/unhappy_customer_istock_00000559835.jpg" alt="Unhappy man" width="426" height="282" /></p>
<p>So naturally I have done what any developer would do and pull apart each and ever piece of code I can find looking for the differences in accuracy.</p>
<p>Some of my current findings:</p>
<p>1. It appears frame accuracy is only available while inside the buffer.<br />
2. If you use the seek() method at all for scrubbing the Netstream.time (used to get the current position) is in-accurate.<br />
3. After a seek has complete and playback accuracy is incorrect the Netstream object will correct itself over time (+-20 seconds)<br />
4. If you set the buffer size to &#8216;0&#8242; the player is in-accurate all the way through.</p>
<p>It seems seek() is the biggest culprit at present and this is most likely to do with the buffer being emptied completly, on initial tests it seems if you call a few step( 1 ) a few times after a seek (giving the NetStream object a chance to sample buffer data) the player will correct itself.</p>
<p>more to follow on my quest to build the frame accurate player hopefully removing the little voices telling me it is not possible and being given a gold star <img src='http://www.tyroneneill.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=319</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Filename Windows Validator</title>
		<link>http://www.tyroneneill.com/?p=291</link>
		<comments>http://www.tyroneneill.com/?p=291#comments</comments>
		<pubDate>Sun, 02 May 2010 12:38:11 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=291</guid>
		<description><![CDATA[A handy Windows 32 File name validator, recently I have been working with media files being saved from a Flex app and creating directories on windows machines for export for some Avid use, Windows has some funny constrains for file names, some examples include using the words [COM/n, CLOCK, CON], these are all included in [...]]]></description>
			<content:encoded><![CDATA[<p>A handy Windows 32 File name validator, recently I have been working with media files being saved from a Flex app and creating directories on windows machines for export for some Avid use, Windows has some funny constrains for file names, some examples include using the words [COM/n, CLOCK, CON], these are all included in the follwoing custom Validator with the usual &#8216;[$, *, etc]&#8216;, hope it is useful to someone out in the wild.</p>
<p>The basic RegExp of the validator</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">internal <span style="color: #000000; font-weight: bold;">function</span> validateWin32<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Check name is not blank</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// Leading, trailing space, dot</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">charAt</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #66cc66;">||</span> <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">charAt</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #66cc66;">||</span>
				<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">charAt</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #66cc66;">||</span> <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">charAt</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot; &quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// Multiple spaces</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> matchPart<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>s<span style="color: #000099; font-weight: bold;">\\</span>s+&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// Explicitly illegal Windows characters</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> matchPart<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">&quot;[$*<span style="color: #000099; font-weight: bold;">\&quot;</span>/<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>[<span style="color: #000099; font-weight: bold;">\\</span>]:;|=,]&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// Control characters</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> matchPart<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">&quot;[<span style="color: #000099; font-weight: bold;">\\</span>x00-<span style="color: #000099; font-weight: bold;">\\</span>x1f]&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// Reserved names. DOS compatibility means that AUX.txt</span>
			<span style="color: #808080; font-style: italic;">// is just as bad as AUX.</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> matchPart<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">target</span>, <span style="color: #ff0000;">&quot;^(?i:CON|PRN|AUX|CLOCK<span style="color: #000099; font-weight: bold;">\$</span>|NUL|COM<span style="color: #000099; font-weight: bold;">\\</span>d|LPT<span style="color: #000099; font-weight: bold;">\\</span>d)(?:<span style="color: #000099; font-weight: bold;">\\</span>..*)?$&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span></pre></div></div>


    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="600" height="350">
      <param name="movie" value="http://www.tyroneneill.com/wp-content/uploads/2010/05/win32validation/FileNameWindows.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://www.tyroneneill.com/wp-content/uploads/2010/05/win32validation/FileNameWindows.swf" width="600" height="350">
      <!--<![endif]-->
        <p>The Flash plugin is required to view this object.</p>
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<p><a href="http://www.tyroneneill.com/wp-content/uploads/2010/05/win32validation/srcview/index.html" target="_blank">View Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=291</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex 4 Optimize those Item Renderers</title>
		<link>http://www.tyroneneill.com/?p=53</link>
		<comments>http://www.tyroneneill.com/?p=53#comments</comments>
		<pubDate>Fri, 05 Mar 2010 22:43:24 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[//]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[item renderers]]></category>
		<category><![CDATA[itemrenderers]]></category>
		<category><![CDATA[Optimize]]></category>
		<category><![CDATA[Optimized]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=53</guid>
		<description><![CDATA[Now, more than ever, is the time to cease adding components to itemrenderers on the whim and start really thinking about what should be included; what  the minimalist components are that will do the job right.

If you are interested in performance and memory issues in AS3 I would highly recommend reading the following:
Fast Integer math:
http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/
If [...]]]></description>
			<content:encoded><![CDATA[<p>Now, more than ever, is the time to cease adding components to itemrenderers on the whim and start really thinking about what should be included; what  the minimalist components are that will do the job right.</p>
<p style="text-align: center;"><img class="aligncenter" title="Fat TileList to Thin TileList" src="http://balancenoosa.files.wordpress.com/2008/05/fat-vs-thin-704233.jpg" alt="" width="347" height="400" /></p>
<p>If you are interested in performance and memory issues in AS3 I would highly recommend reading the following:</p>
<p><strong>Fast Integer math:</strong><br />
<a href="http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/">http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/</a></p>
<blockquote><p>If you constantly have to measure items for display (positions etc&#8230;) it can have a lot of benefit using &#8216;Bitwise Operators&#8217; (x <strong>&lt;&lt;</strong> 1) as they are incredibly faster than your typical native operators (x <strong>*</strong> 2)</p></blockquote>
<p><strong>Optimizing Mobile Content:</strong><br />
<a href="http://www.bytearray.org/?p=1363">http://www.bytearray.org/?p=1363</a></p>
<blockquote><p>This is by far the greatest white paper I have found so far about generally optimizing AS3.  Do not let the mobile part detour you -  a very good read for flash overall</p></blockquote>
<p><strong>Using Vectors in Actionscript:</strong><br />
<a href="http://www.mikechambers.com/blog/2008/08/19/using-vectors-in-actionscript-3-and-flash-player-10/">Mike Chambers Article -&gt;</a></p>
<blockquote><p>The new Vector class is simply a typed &#8216;Array&#8217; with huge performance benefits (Kick ass and chew bubblegum)</p></blockquote>
<h1>On to some more Item Renderer specific guidelines</h1>
<p>____________________________________________________________________________________</p>
<h3><strong>Extract the common visual elements</strong></h3>
<p style="padding-left: 30px;">It is a good starting point to extract all the common visual items from the itemrenderers. Particularly useful if you use <strong>&#8216;on mouseOver show&#8217;</strong> controls as illustrated below:</p>
<p><a href="http://www.tyroneneill.com/wp-content/uploads/2010/02/rollovertilelistcontrols.jpg"><img class="aligncenter size-full wp-image-114" title="rollovertilelistcontrols" src="http://www.tyroneneill.com/wp-content/uploads/2010/02/rollovertilelistcontrols.jpg" alt="" width="481" height="310" /></a><br />
As you can see the controls are only required when a user rolls over an Item and therefore these controls (play &amp;&amp; download buttons) only need to be instantiated once == Yippie much better performance + lower memory usage.</p>
<p><em>How to create the above TileList example:</em></p>
<p>Each Item Renderer will only have the Image and associated text (in this case album/artist name) and the controls will be created and added to the parent item (List &#8211; Gumbo, TileList-Flex3 etc&#8230;), we can then listen to the ITEM_ROLL_OUT &amp;&amp; ITEM_ROLL_OVER events and position/show our controls accordingly using the X &amp; Y coordinates of the event.target which will be each Item in the list.</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="600" height="350">
      <param name="movie" value="http://www.tyroneneill.com/wp-content/uploads/2010/02/extractedConstantsFromTileList/ExtractedConstantsFromTileList.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://www.tyroneneill.com/wp-content/uploads/2010/02/extractedConstantsFromTileList/ExtractedConstantsFromTileList.swf" width="600" height="350">
      <!--<![endif]-->
        <p>The Flash plugin is required to view this object.</p>
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<p><a href="http://www.tyroneneill.com/wp-content/uploads/2010/02/extractedConstantsFromTileList/srcview/" target="_blank">View Source</a></p>
<p>As you scroll through the above list you can see the <strong>RED</strong> square following the items in the list (I am using tweener to follow the list but this can be popped up in the correct position instantly), it is not so apparently beneficial with so little items though start to increase the numbers and watch the render time lower and physical memory usage drop off.</p>
<h3><strong>Using images inside an itemrenderer</strong></h3>
<p style="padding-left: 30px;">The approach to take is dependant on if the images are static or dynamic/remote, I&#8217;ll cover remote images in detail though by doing this it should answer any query&#8217;s you may have about static ones.</p>
<p style="padding-left: 30px;"><strong>Remote/Dynamic Images</strong></p>
<p style="padding-left: 30px;">The easiest and heavy approach is to simply use the &#8220;Image&#8221; component (mx.controls.Image), the Image is great to use outside of an itemrender though you when you look into the image class you realize it extends SWFLoader (hence why all the loading is done for you), this can be extremely expensive in memory.</p>
<p style="padding-left: 30px;">Solution: Use the new BitmapImage (spark.primitives.BitmapImage) component in junction with a static loader class (Simple static class external where all loading is handled for you).</p>
<p style="padding-left: 30px;">You could also make use of current &#8216;<strong>Bulk Loaders</strong>&#8216; such as <a href="http://code.google.com/p/bulk-loader">http://code.google.com/p/bulk-loader/</a>, It is almost always better to build these types of things yourself though (in terms of performance), if anybody needs some more details please just Twitter/Hola/Email/Touch-Me</p>
<h3><strong><strong>Text</strong></strong></h3>
<p style="padding-left: 30px;">When building Flex 4 Applications you should use the Spark controls where possible, the spark controls are lighter and have better font embedding, if you are NOT using &#8220;Right to Left&#8221; text you should NOT be using RichText (made the mistake early on).</p>
<p style="padding-left: 30px;">The spark label (spark.components.Label) field is <strong>light </strong>enough to use with large data providers</p>
<p style="padding-left: 30px;">nothing more to say here&#8230;.</p>
<h3><strong><strong><strong><strong>Events </strong></strong></strong></strong></h3>
<p style="padding-left: 30px;">As much as we would like &#8216;Events&#8217; not to be used inside item renderers we simply can not survive without them, one of the key things to remember is that if we do not <strong>REMOVE/DISPOSE</strong> the EventListeners when the itemrenderer is destroyed (removed from stage, data changed in list) the flash <strong>Garbage Collector</strong> may not be able to completely destroy it.</p>
<p style="padding-left: 30px;">

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
* Dispose Item
* @public
* */</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	removeEventListeners<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">//Destroy Children &amp;amp;&amp;amp; Elements</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
* Activate Deactivate Component
* @private
* */</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> activateDeactivate<span style="color: #66cc66;">&#40;</span> evt:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span> evt.<span style="color: #0066CC;">type</span> <span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">case</span> Event.<span style="color: #006600;">ADDED_TO_STAGE</span>:
			addEventListeners<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
		<span style="color: #b1b100;">case</span> Event.<span style="color: #006600;">REMOVED_FROM_STAGE</span>:
			dispose<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">break</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">/**
* Add Event Listeners
* @private
* */</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> addEventListeners<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">REMOVED_FROM_STAGE</span>, activateDeactivate, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">/**
* Remove Event Listeners
* @private
* */</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> removeEventListeners<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	removeEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">REMOVED_FROM_STAGE</span>, activateDeactiveHandler, <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
       <span style="color: #808080; font-style: italic;">//Remove all other event listeners here</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This example shows how you could handle adding and removing events from the renderer, when the renderer is destroyed it is removed from the stage causing the Event.REMOVED_FROM_STAGE to dispatch, we can not remove all events and make sure all children/elements are destroyed correctly (Garbage Collector == Happy).</p>
<p>Typical I create an interface (IDisposable) and implement this with <strong>function destroy( ):void</strong>.</p>
<p>It would be worth noting this applies to any custom component, it is good to clean up after yourself (remember wifey giving you a hard time about the dishes!)</p>
<h3><strong>Timers VS EnterFrame</strong></h3>
<p style="padding-left: 30px;">I have no idea why somebody would need either of these in Itemrenderer&#8217;s, perhaps some Photoshop ninja requires an animated swirl every couple of seconds to tempt users to interact.  I would personally  fight this off as much as possible, though if  unavoidable it is good to understand the differences between these two approaches.</p>
<p style="padding-left: 30px;"><em>The facts:</em></p>
<ol>
<li> Timers are more <em>expensive</em> than the EnterFrame event (more CPU intensive).</li>
<li> Timers are more <em>accurate</em> than the EnterFrame as the EnterFrame event relies heavily on a users CPU (a slower CPU == less times EnterFrame fired) though it is not true that the Timer is 100% accurate itself, more information can be found here <a href="http://www.bit-101.com/blog/?p=910">http://www.bit-101.com/blog/?p=910</a></li>
</ol>
<p>This is getting long and bloated which is exactly what I wanted to avoid, maybe this should be done in parts (see you in part II)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=53</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flex Spark TileLayout extra space</title>
		<link>http://www.tyroneneill.com/?p=34</link>
		<comments>http://www.tyroneneill.com/?p=34#comments</comments>
		<pubDate>Tue, 26 Jan 2010 16:58:45 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[extra space]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Spark]]></category>
		<category><![CDATA[TileLayout]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=34</guid>
		<description><![CDATA[So Flex 4 is in Beta and we should accept that quirks will occure but this one is driving me a little loopy to the point of even cursing my friend Flex.
The day started like any other until I noticed this unnecessary gap between each of my vertically stacked list&#8217;s using the TileLayout, yes it [...]]]></description>
			<content:encoded><![CDATA[<p>So Flex 4 is in Beta and we should accept that quirks will occure but this one is driving me a little loopy to the point of even cursing my friend Flex.</p>
<p>The day started like any other until I noticed this unnecessary gap between each of my vertically stacked list&#8217;s using the TileLayout, yes it is very possible to take the approach of creating my own layout (that&#8217;s why the new Flex 4 Framework is so good) though I opted for looking for a property that might remove this, disaster! disaster! nothing works so next step is to extend tile list and look for this weird occurance.</p>
<p>Best I could do (though not completly happy with) is override the measure() and change the explicit height of the component as it seems explicit height is forcing the constant height.</p>
<p>Hopefully this helps somebody out or even better can direct me to a better fix</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">skysongs</span>.<span style="color: #006600;">mediaplayer</span>.<span style="color: #006600;">view</span>.<span style="color: #006600;">layouts</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">ILayoutElement</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">components</span>.<span style="color: #006600;">supportClasses</span>.<span style="color: #006600;">GroupBase</span>;
	<span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">layouts</span>.<span style="color: #006600;">TileLayout</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MusicTileLayout <span style="color: #0066CC;">extends</span> TileLayout
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">/**
		 * Constructor
		 * */</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MusicTileLayout<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;
		<span style="color: #808080; font-style: italic;">/**
		 * Measure
		 * @inheritDoc
		 */</span>
		override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> measure<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: #000000; font-weight: bold;">var</span> layoutTarget:GroupBase = <span style="color: #0066CC;">target</span>;
			layoutTarget.<span style="color: #006600;">explicitHeight</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">ceil</span><span style="color: #66cc66;">&#40;</span>rowCount <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>rowHeight + verticalGap<span style="color: #66cc66;">&#41;</span> - verticalGap<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">super</span>.<span style="color: #006600;">measure</span><span style="color: #66cc66;">&#40;</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>Please hurry up Adobe, I want the final release now&#8230;</p>
<p>ADDED!!! in case the measure property is not called when resizing is done you can override updateDisplayList and call the measure() function.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
		 * Update Display List
		 * @inheritDoc
		 * */</span>
		override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">height</span>:<span style="color: #0066CC;">Number</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;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">height</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">/* Force remeasure */</span>
			measure<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Again I would not recommend this as a final solution (will most likely be fixed in an upcoming version of the SDK)</p>
<p>ps.. Logged an issue with Adobe (http://forums.adobe.com/thread/565055)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=34</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>2010 Artists Chart</title>
		<link>http://www.tyroneneill.com/?p=7</link>
		<comments>http://www.tyroneneill.com/?p=7#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:48:35 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Music Chart]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=7</guid>
		<description><![CDATA[A bit sick of good old Simon Cowells mass generated money making chart? here are some artists I put together over months of working on Sky Songs (http://www.skysongs.com).
This is also to remind myself what music I like  
The Happy Artists 2010:
Nellie Mckay (Different and fun with some intresting political views)
Regina Spektor (Brilliant, absolutely )
The [...]]]></description>
			<content:encoded><![CDATA[<p>A bit sick of good old Simon Cowells mass generated money making chart? here are some artists I put together over months of working on Sky Songs (<a href="http://songs.sky.com/" target="_blank">http://www.skysongs.com</a>).</p>
<p>This is also to remind myself what music I like <img src='http://www.tyroneneill.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The Happy Artists 2010:</p>
<p><a href="http://songs.sky.com/#artists/Nellie+Mckay/d0143f2cd686480cb4997979525a7a42" target="_blank">Nellie Mckay</a> (Different and fun with some intresting political views)</p>
<p><a href="http://songs.sky.com/#artists/Regina+Spektor/da84bdcdb7344e878fcc650ed656f5e8" target="_blank">Regina Spektor</a> (Brilliant, absolutely )</p>
<p><a href="http://songs.sky.com/#artists/The+Ditty+Bops/c9ac3c7de3794dd4b60d818252c189a1" target="_blank">The Ditty Bops</a></p>
<p><a href="http://songs.sky.com/#artists/Amanda+Palmer/c5343fb1a0f348b8b0a61a337344812c" target="_blank">Amanda Palmer</a> (Will ok maybe not always this happy but a good listen)</p>
<p><a href="http://songs.sky.com/#artists/Eels/59b95912d19c4132acbee49a7360543b" target="_blank">The Eels </a>(blocked out many annoying brats on the tube)</p>
<p><a href="http://songs.sky.com/#artists/Mumford+&amp;+Sons/6cb22b364e634fa8bd9f69597778e913" target="_blank">Mumford &amp; Sons</a> (If you have never heard it, it&#8217;s a must)</p>
<p><a href="http://songs.sky.com/#artists/Shakespears+Sister/7c6bb9e2755d42b98900c9b756b9f298" target="_blank">Shakespears Sister</a> (New album after yonks)</p>
<p><a href="http://songs.sky.com/#artists/Nightmares+on+Wax/dc6ba87e33bf4c9bad4adfb95c88b312" target="_blank">Nightmared on Wax</a> (Different to say the least)</p>
<p>Look at this I am just getting started and not once have I had to mention Lady boo boo and Joe Mck-something, I think it is high time we start to share real music with the world and not this teenage inspired chart (oh to rant on)</p>
<p>More music posts will be coming soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ty says hello&#8230;</title>
		<link>http://www.tyroneneill.com/?p=1</link>
		<comments>http://www.tyroneneill.com/?p=1#comments</comments>
		<pubDate>Sun, 01 Nov 2009 14:49:53 +0000</pubDate>
		<dc:creator>Tyrone Neill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tyroneneill.com/?p=1</guid>
		<description><![CDATA[Welcome to very own spiffy new blog, no idea what fruitless topics I will be talking about though hope to keep myself amused (the little people inside my head)
]]></description>
			<content:encoded><![CDATA[<p>Welcome to very own spiffy new blog, no idea what fruitless topics I will be talking about though hope to keep myself amused (the little people inside my head)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tyroneneill.com/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
