<?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>benwatts.ca &#187; displaylist</title>
	<atom:link href="http://benwatts.ca/tag/displaylist/feed/" rel="self" type="application/rss+xml" />
	<link>http://benwatts.ca</link>
	<description>Designer and Frontend Developer in Ottawa, Canada</description>
	<lastBuildDate>Fri, 22 Jul 2011 19:00:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Removing Everything from a Display Container</title>
		<link>http://benwatts.ca/2008/removing-everything-from-a-display-container/</link>
		<comments>http://benwatts.ca/2008/removing-everything-from-a-display-container/#comments</comments>
		<pubDate>Mon, 26 May 2008 00:28:24 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[displaylist]]></category>

		<guid isPermaLink="false">http://seaturtle.rainiscold.ca/?p=48</guid>
		<description><![CDATA[I ran into this problem and couldn&#8217;t figure out what was going on because I fail miserably: // doesn't work because as this code executes numChildren is decreasing; // it ends up not removing everything for&#40;var i:Number=0; i &#38;lt; numChildren; i++&#41;&#123; &#160; removeChildAt&#40;i&#41;; &#125; The solution: while&#40; numChildren &#62; 0 &#41;&#123; &#160; removeChildAt&#40;0&#41;; &#125; This [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into this problem and couldn&#8217;t figure out what was going on <strong><em>because I fail miserably</em></strong>:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// doesn't work because as this code executes numChildren is decreasing;</span><br />
<span style="color: #009900; font-style: italic;">// it ends up not removing everything</span><br />
<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #004993;">numChildren</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>The solution:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">while</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">numChildren</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>This expression is useful for deleting things from the bottom of the displayList up.</p>
]]></content:encoded>
			<wfw:commentRss>http://benwatts.ca/2008/removing-everything-from-a-display-container/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sifting Through the Display List to Delete Things</title>
		<link>http://benwatts.ca/2008/sifting-through-the-display-list-to-delete-things/</link>
		<comments>http://benwatts.ca/2008/sifting-through-the-display-list-to-delete-things/#comments</comments>
		<pubDate>Mon, 19 May 2008 14:31:51 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[displaylist]]></category>

		<guid isPermaLink="false">http://seaturtle.rainiscold.ca/?p=44</guid>
		<description><![CDATA[Hah, it&#8217;s a pretty specific case &#8230; but this checks the last item of the display list and removes it if it partially matches (indexOf) the name on the display list item. This requires that the display list item to be given a name. var myClip:MovieClip = new MovieClip&#40;&#41;; myClip.name = &#34;thenameofit&#34;; if&#40; getChildAt&#40;numChildren-1&#41;.name.indexOf&#40;&#34;thenameofit&#34;&#41; &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Hah, it&#8217;s a pretty specific case &#8230; but this checks the last item of the display list and removes it if it partially matches (indexOf) the name on the display list item. This requires that the display list item to be given a name.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> myClip<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
myClip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> = <span style="color: #990000;">&quot;thenameofit&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span>numChildren<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;thenameofit&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span>numChildren<span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Yeah. Heh. So I&#8217;m keeping this code around, why? It could be used in the program I&#8217;m writing now, but it&#8217;s not nearly flexible enough as this, which loops through the display list and removes any child with containing a partially match of &#8220;deleteme&#8221;. Much more flexible, but also more intensive in a complex movie?</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span> <span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">numChildren</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'deleteme'</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">removeChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://benwatts.ca/2008/sifting-through-the-display-list-to-delete-things/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

