<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: AS3: remove All Children in a DisplayObject</title>
	<atom:link href="http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/</link>
	<description>Flash, Web, Javascript and everything else</description>
	<lastBuildDate>Wed, 21 Dec 2011 16:21:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: sanjay Ramani</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-44124</link>
		<dc:creator>sanjay Ramani</dc:creator>
		<pubDate>Thu, 21 Jul 2011 05:50:29 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-44124</guid>
		<description>i am try this.
it&#039;s work


			if(this.numChildren!=0){
				var k:int = this.numChildren;
				while( k -- )
				{
					child = this.getChildAt(k);
					if (child)
					{
						if (child.parent)
						{
							child.parent.removeChild(child);
							child = null;
						}
					}
				}
			}</description>
		<content:encoded><![CDATA[<p>i am try this.<br />
it&#8217;s work</p>
<p>			if(this.numChildren!=0){<br />
				var k:int = this.numChildren;<br />
				while( k &#8212; )<br />
				{<br />
					child = this.getChildAt(k);<br />
					if (child)<br />
					{<br />
						if (child.parent)<br />
						{<br />
							child.parent.removeChild(child);<br />
							child = null;<br />
						}<br />
					}<br />
				}<br />
			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: firos</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-35791</link>
		<dc:creator>firos</dc:creator>
		<pubDate>Thu, 20 Jan 2011 05:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-35791</guid>
		<description>Also use this..
private function removeChildrenOf(container:Sprite):void {
	while (container.numChildren != 0) {
		container.removeChildAt(0);
	 }
}</description>
		<content:encoded><![CDATA[<p>Also use this..<br />
private function removeChildrenOf(container:Sprite):void {<br />
	while (container.numChildren != 0) {<br />
		container.removeChildAt(0);<br />
	 }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edwin</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-32912</link>
		<dc:creator>Edwin</dc:creator>
		<pubDate>Mon, 22 Nov 2010 17:02:08 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-32912</guid>
		<description>Hi Isaac, yes you&#039;re right. The code above should remove all the children from the stage. However, if there are timers or sounds running in the children, then they will not be collected for GC. 

What you can do instead is check if there are sound/timer objects playing in those children, stop them, and then remove the child from the parent. This generally happens when you use code in the timeline.</description>
		<content:encoded><![CDATA[<p>Hi Isaac, yes you&#8217;re right. The code above should remove all the children from the stage. However, if there are timers or sounds running in the children, then they will not be collected for GC. </p>
<p>What you can do instead is check if there are sound/timer objects playing in those children, stop them, and then remove the child from the parent. This generally happens when you use code in the timeline.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: isaac ewing</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-32911</link>
		<dc:creator>isaac ewing</dc:creator>
		<pubDate>Mon, 22 Nov 2010 16:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-32911</guid>
		<description>while(mc.numChildren =&gt; 0)
    mc.removeChildAt(mc.numChildren – 1)

with the code above, doesn&#039;t it still leave out some child containers from the movieclip.. for example, let&#039;s say you are loading something, it finished and now you are removing the loader from the stage, using the method above will keep several objects from going to garbage collection, even if you declare the loader to null.... any ideas on how to clean that more efficently...</description>
		<content:encoded><![CDATA[<p>while(mc.numChildren =&gt; 0)<br />
    mc.removeChildAt(mc.numChildren – 1)</p>
<p>with the code above, doesn&#8217;t it still leave out some child containers from the movieclip.. for example, let&#8217;s say you are loading something, it finished and now you are removing the loader from the stage, using the method above will keep several objects from going to garbage collection, even if you declare the loader to null&#8230;. any ideas on how to clean that more efficently&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ran</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24713</link>
		<dc:creator>ran</dc:creator>
		<pubDate>Sun, 10 Jan 2010 01:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24713</guid>
		<description>Sorry, i think, this code is better, else the container will have one remaining child :

while(mc.numChildren =&gt; 0)
{
mc.removeChildAt(mc.numChildren – 1)
}</description>
		<content:encoded><![CDATA[<p>Sorry, i think, this code is better, else the container will have one remaining child :</p>
<p>while(mc.numChildren =&gt; 0)<br />
{<br />
mc.removeChildAt(mc.numChildren – 1)<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ran</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24712</link>
		<dc:creator>ran</dc:creator>
		<pubDate>Sun, 10 Jan 2010 01:38:43 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24712</guid>
		<description>Hello,

I think that it would be better to do as follows, so that the container does not recalculte its children &#039;s index every time a child is removed

while(mc.numChildren)
{
    mc.removeChildAt(mc.numChildren - 1)
}</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I think that it would be better to do as follows, so that the container does not recalculte its children &#8216;s index every time a child is removed</p>
<p>while(mc.numChildren)<br />
{<br />
    mc.removeChildAt(mc.numChildren &#8211; 1)<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jasmeet</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24678</link>
		<dc:creator>Jasmeet</dc:creator>
		<pubDate>Fri, 08 Jan 2010 00:27:01 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24678</guid>
		<description>I bet nothing better than this (it is fastest, less code, robust )

while(mc.numChildren) {
mc.removeChildAt(0)
}</description>
		<content:encoded><![CDATA[<p>I bet nothing better than this (it is fastest, less code, robust )</p>
<p>while(mc.numChildren) {<br />
mc.removeChildAt(0)<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DarkSuiyoken</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24618</link>
		<dc:creator>DarkSuiyoken</dc:creator>
		<pubDate>Mon, 04 Jan 2010 23:49:54 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24618</guid>
		<description>wow, thanks for this everyone.</description>
		<content:encoded><![CDATA[<p>wow, thanks for this everyone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josefk</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24616</link>
		<dc:creator>josefk</dc:creator>
		<pubDate>Mon, 04 Jan 2010 23:33:19 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24616</guid>
		<description>This would do it too:
function removeChildrenOf(docTarget:DisplayObjectContainer):void {
   while(docTarget.numChildren) {
      docTarget.removeChildAt(0)
   }
}

I wonder if there is any difference in execution speed..</description>
		<content:encoded><![CDATA[<p>This would do it too:<br />
function removeChildrenOf(docTarget:DisplayObjectContainer):void {<br />
   while(docTarget.numChildren) {<br />
      docTarget.removeChildAt(0)<br />
   }<br />
}</p>
<p>I wonder if there is any difference in execution speed..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mem's</title>
		<link>http://www.designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/comment-page-1/#comment-24614</link>
		<dc:creator>Mem's</dc:creator>
		<pubDate>Mon, 04 Jan 2010 22:59:57 +0000</pubDate>
		<guid isPermaLink="false">http://designfission.com/blog/2010/01/05/as3-remove-all-movieclips-and-sprites-in-a-displayobject/#comment-24614</guid>
		<description>You can do that with a sorter version:

while(mc.numChilren &gt; 0)
  mc.removeChildAt(0);</description>
		<content:encoded><![CDATA[<p>You can do that with a sorter version:</p>
<p>while(mc.numChilren &gt; 0)<br />
  mc.removeChildAt(0);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Content Delivery Network via dfblog.qwertydesign.netdna-cdn.com

Served from: www.designfission.com @ 2012-02-10 08:10:18 -->
