<?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: Utility Functions For DisplayObjects</title>
	<atom:link href="http://jacksondunstan.com/articles/519/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/519</link>
	<description>Mastering AS3</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:30:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-527</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Wed, 17 Feb 2010 07:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-527</guid>
		<description>I don&#039;t think it&#039;s any faster or slower, just my habit from years of using the &lt;a href=&quot;http://www.sgi.com/tech/stl/&quot; rel=&quot;nofollow&quot;&gt;C++ STL&lt;/a&gt; where pre-incrementing an iterator is faster than post-incrementing. These days I just think it lends some visual balance to the line of code. :)</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think it&#8217;s any faster or slower, just my habit from years of using the <a href="http://www.sgi.com/tech/stl/" rel="nofollow">C++ STL</a> where pre-incrementing an iterator is faster than post-incrementing. These days I just think it lends some visual balance to the line of code. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denis</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-525</link>
		<dc:creator>Denis</dc:creator>
		<pubDate>Wed, 17 Feb 2010 03:50:06 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-525</guid>
		<description>Hi Jakson,

Could you explain why did you use pre-increment in the getChildren function and not post-increment? Is it significant difference?</description>
		<content:encoded><![CDATA[<p>Hi Jakson,</p>
<p>Could you explain why did you use pre-increment in the getChildren function and not post-increment? Is it significant difference?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonny Reeves</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-491</link>
		<dc:creator>Jonny Reeves</dc:creator>
		<pubDate>Wed, 10 Feb 2010 12:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-491</guid>
		<description>Simple but effective:
&lt;pre lang=&quot;actionscript3&quot;&gt;
/**
 * Returns a Bitmap instance of the supplied DisplayObject.
 */
public static function createBitmap(source : DisplayObject, useSmoothing : Boolean = true) : Bitmap
{
	const bitmapData : BitmapData = new BitmapData(source.width, source.height, true, 0xffffff);
	bitmapData.draw(source);
	
	const bitmap : Bitmap = new Bitmap(bitmapData);
	bitmap.smoothing = useSmoothing;
	
	return bitmap;
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Simple but effective:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/**
 * Returns a Bitmap instance of the supplied DisplayObject.
 */</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> createBitmap<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">DisplayObject</span>, useSmoothing <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Bitmap</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">const</span> <span style="color: #004993;">bitmapData</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>.<span style="color: #004993;">width</span>, <span style="color: #004993;">source</span>.<span style="color: #004993;">height</span>, <span style="color: #0033ff; font-weight: bold;">true</span>, 0xffffff<span style="color: #000000;">&#41;</span>;
    <span style="color: #004993;">bitmapData</span>.<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #6699cc; font-weight: bold;">const</span> bitmap <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Bitmap</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">bitmapData</span><span style="color: #000000;">&#41;</span>;
    bitmap.<span style="color: #004993;">smoothing</span> = useSmoothing;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">return</span> bitmap;
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-443</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Fri, 11 Dec 2009 17:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-443</guid>
		<description>&lt;tt&gt;getFullBounds&lt;/tt&gt; is really interesting. I applied formatting and cleaned up some HTML safety stuff. Thanks for contributing!</description>
		<content:encoded><![CDATA[<p><tt>getFullBounds</tt> is really interesting. I applied formatting and cleaned up some HTML safety stuff. Thanks for contributing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt W</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-442</link>
		<dc:creator>Matt W</dc:creator>
		<pubDate>Fri, 11 Dec 2009 16:01:46 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-442</guid>
		<description>&lt;pre lang=&quot;actionscript3&quot;&gt;
/**
 * Determines the full bounds of the display object regardless of masking elements.
 * @param	displayObject	The display object to analyze.
 * @return	the display object dimensions.
 */
public static function getFullBounds( displayObject:DisplayObject ):Rectangle
{
	var bounds:Rectangle, transform:Transform, toGlobalMatrix:Matrix, currentMatrix:Matrix;

	transform = displayObject.transform;
	currentMatrix = transform.matrix;
	toGlobalMatrix = transform.concatenatedMatrix;
	toGlobalMatrix.invert();
	transform.matrix = toGlobalMatrix;
 
	bounds = transform.pixelBounds.clone();
 
	transform.matrix = currentMatrix;
 
	return bounds;
}

/**
 * Stops all timelines of the specified display object and its children.
 * @param	displayObject	The display object to loop through.
 */
public static function stopAllTimelines( displayObject:DisplayObjectContainer ):void
{
	var numChildren:int = displayObject.numChildren;
	
	for (var i:int = 0; i &lt; numChildren; i++ )
	{
		var child:DisplayObject = displayObject.getChildAt( i );
		
		if ( child is DisplayObjectContainer ) 
		{
			if ( child is MovieClip ) 
			{
				MovieClip( child ).stop();
			}
			
			stopAllTimelines( child as DisplayObjectContainer );
		}
	}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/**
 * Determines the full bounds of the display object regardless of masking elements.
 * @param    displayObject    The display object to analyze.
 * @return    the display object dimensions.
 */</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> getFullBounds<span style="color: #000000;">&#40;</span> displayObject<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> bounds<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span>, <span style="color: #004993;">transform</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Transform</span>, toGlobalMatrix<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Matrix</span>, currentMatrix<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Matrix</span>;
&nbsp;
    <span style="color: #004993;">transform</span> = displayObject.<span style="color: #004993;">transform</span>;
    currentMatrix = <span style="color: #004993;">transform</span>.<span style="color: #004993;">matrix</span>;
    toGlobalMatrix = <span style="color: #004993;">transform</span>.<span style="color: #004993;">concatenatedMatrix</span>;
    toGlobalMatrix.<span style="color: #004993;">invert</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #004993;">transform</span>.<span style="color: #004993;">matrix</span> = toGlobalMatrix;
&nbsp;
    bounds = <span style="color: #004993;">transform</span>.<span style="color: #004993;">pixelBounds</span>.<span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    <span style="color: #004993;">transform</span>.<span style="color: #004993;">matrix</span> = currentMatrix;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">return</span> bounds;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Stops all timelines of the specified display object and its children.
 * @param    displayObject    The display object to loop through.
 */</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> stopAllTimelines<span style="color: #000000;">&#40;</span> displayObject<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObjectContainer</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">numChildren</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = displayObject.<span style="color: #004993;">numChildren</span>;
&nbsp;
    <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: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #004993;">numChildren</span>; i<span style="color: #000000; font-weight: bold;">++</span> <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">child</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span> = displayObject.<span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span> i <span style="color: #000000;">&#41;</span>;
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #004993;">child</span> <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">DisplayObjectContainer</span> <span style="color: #000000;">&#41;</span> 
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #004993;">child</span> <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">MovieClip</span> <span style="color: #000000;">&#41;</span> 
            <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">child</span> <span style="color: #000000;">&#41;</span>.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            stopAllTimelines<span style="color: #000000;">&#40;</span> <span style="color: #004993;">child</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">DisplayObjectContainer</span> <span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-441</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Thu, 10 Dec 2009 17:48:31 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-441</guid>
		<description>I&#039;ve added code formatting and cleaned up the HTML safety stuff that got applied. I can see some of these being very handy. Also, I really like your concise &lt;tt&gt;for&lt;/tt&gt; loops over children:

&lt;pre lang=&quot;actionscript3&quot;&gt;
for (var i:int = 0, len = obj.numChildren; i &lt; len; ++i)
{
	// ...
}
&lt;/pre&gt;

Compared to a &lt;tt&gt;for-each&lt;/tt&gt; over my &lt;tt&gt;getChildren&lt;/tt&gt; it&#039;s more efficient, but also more typing. Still, it&#039;s nice to have options like these. Thanks for the contribution!</description>
		<content:encoded><![CDATA[<p>I&#8217;ve added code formatting and cleaned up the HTML safety stuff that got applied. I can see some of these being very handy. Also, I really like your concise <tt>for</tt> loops over children:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><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: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>, len = obj.<span style="color: #004993;">numChildren</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> len; <span style="color: #000000; font-weight: bold;">++</span>i<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #009900;">// ...</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Compared to a <tt>for-each</tt> over my <tt>getChildren</tt> it&#8217;s more efficient, but also more typing. Still, it&#8217;s nice to have options like these. Thanks for the contribution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-440</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Thu, 10 Dec 2009 17:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-440</guid>
		<description>Thanks for the tip. I actually wrote &lt;tt&gt;wait&lt;/tt&gt; while I was new to AS3 and didn&#039;t know that other &lt;tt&gt;DisplayObject&lt;/tt&gt; derivatives could get the ENTER_FRAME event. It seems counter-intuitive to me, since they don&#039;t have frames. I&#039;ve updated the article to use a &lt;tt&gt;Shape&lt;/tt&gt; since it seems like the cheapest object that will dispatch the event. Lastly, thanks for your contribution!</description>
		<content:encoded><![CDATA[<p>Thanks for the tip. I actually wrote <tt>wait</tt> while I was new to AS3 and didn&#8217;t know that other <tt>DisplayObject</tt> derivatives could get the ENTER_FRAME event. It seems counter-intuitive to me, since they don&#8217;t have frames. I&#8217;ve updated the article to use a <tt>Shape</tt> since it seems like the cheapest object that will dispatch the event. Lastly, thanks for your contribution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Knocking</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-439</link>
		<dc:creator>Karl Knocking</dc:creator>
		<pubDate>Thu, 10 Dec 2009 11:32:11 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-439</guid>
		<description>I really like the for-loop in the isVisible Function. Althoug i think i never needed such a function. ;)

One suggestion: Wouldn&#039;t it be better to use DisplayObject or EventDispatcher in the wait-function instead of MovieClip?

Here&#039;s a function that I often use. It let&#039;s you find the position of one MovieClip in the coordinate system of another one:
&lt;pre lang=&quot;actionscript3&quot;&gt;
public static function relativePos(dO1:DisplayObject, dO2:DisplayObject):Point{
	var pos:Point = new Point(0,0);
	pos = dO1.localToGlobal(pos);
	pos = dO2.globalToLocal(pos);
	return pos;
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I really like the for-loop in the isVisible Function. Althoug i think i never needed such a function. ;)</p>
<p>One suggestion: Wouldn&#8217;t it be better to use DisplayObject or EventDispatcher in the wait-function instead of MovieClip?</p>
<p>Here&#8217;s a function that I often use. It let&#8217;s you find the position of one MovieClip in the coordinate system of another one:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> relativePos<span style="color: #000000;">&#40;</span>dO1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>, dO2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> pos<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
    pos = dO1.<span style="color: #004993;">localToGlobal</span><span style="color: #000000;">&#40;</span>pos<span style="color: #000000;">&#41;</span>;
    pos = dO2.<span style="color: #004993;">globalToLocal</span><span style="color: #000000;">&#40;</span>pos<span style="color: #000000;">&#41;</span>;
    <span style="color: #0033ff; font-weight: bold;">return</span> pos;
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: vitaLee</title>
		<link>http://jacksondunstan.com/articles/519/comment-page-1#comment-438</link>
		<dc:creator>vitaLee</dc:creator>
		<pubDate>Thu, 10 Dec 2009 08:29:51 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=519#comment-438</guid>
		<description>&lt;pre lang=&quot;actionscript3&quot;&gt;
public static function filterChildrenByProps(container:DisplayObjectContainer, props:Object):Array {
			var filteredChildren:Array = [];
			var child			:DisplayObject;
			
			for (var i:int = 0, l = container.numChildren; i &lt; l; i++) {
				child = container.getChildAt(i);
				var isOK:Boolean = true;
				for (var prop:String in props) {
					if (child[prop] != props[prop]){
						isOK = false;
						break;
					}
				}
				if(isOK) filteredChildren.push(child);
			}
			return filteredChildren;
		}



public static function setProperties(children:Array, props:Object):void {
			var child:DisplayObject;
			for (var i:int = 0, l = children.length; i &lt; l; i++) {
				child = children[i];
				for(var prop:String in props) {
					child[prop] = props[prop];
				}
			}
		}


public static function sumProps(children:Array, prop:String):Number {
			var sum:Number = 0;
			for (var i:int = 0, l = children.length; i &lt; l; i++) {
				sum += children[i][prop];
			}
			return sum;
		}

public static function originalWidth(obj:DisplayObject):Number {
			return obj.width / obj.scaleX;
		}
		
		public static function originalHeight(obj:DisplayObject):Number {
			return obj.height / obj.scaleY;
		}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> filterChildrenByProps<span style="color: #000000;">&#40;</span>container<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObjectContainer</span>, props<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> filteredChildren<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>;
            <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">child</span>            <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>;
&nbsp;
            <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: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>, l = container.<span style="color: #004993;">numChildren</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> l; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">child</span> = container.<span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>;
                <span style="color: #6699cc; font-weight: bold;">var</span> isOK<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
                <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #0033ff; font-weight: bold;">in</span> props<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                    <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span> <span style="color: #000000; font-weight: bold;">!</span>= props<span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
                        isOK = <span style="color: #0033ff; font-weight: bold;">false</span>;
                        <span style="color: #0033ff; font-weight: bold;">break</span>;
                    <span style="color: #000000;">&#125;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>isOK<span style="color: #000000;">&#41;</span> filteredChildren.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">child</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> filteredChildren;
        <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> setProperties<span style="color: #000000;">&#40;</span><span style="color: #004993;">children</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>, props<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">child</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>;
            <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: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>, l = <span style="color: #004993;">children</span>.<span style="color: #004993;">length</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> l; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">child</span> = <span style="color: #004993;">children</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>;
                <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #0033ff; font-weight: bold;">in</span> props<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                    <span style="color: #004993;">child</span><span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span> = props<span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span>;
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> sumProps<span style="color: #000000;">&#40;</span><span style="color: #004993;">children</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>, prop<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> sum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span>;
            <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: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>, l = <span style="color: #004993;">children</span>.<span style="color: #004993;">length</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> l; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                sum <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #004993;">children</span><span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>prop<span style="color: #000000;">&#93;</span>;
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> sum;
        <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> originalWidth<span style="color: #000000;">&#40;</span>obj<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> obj.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> obj.<span style="color: #004993;">scaleX</span>;
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> originalHeight<span style="color: #000000;">&#40;</span>obj<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> obj.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> obj.<span style="color: #004993;">scaleY</span>;
        <span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>
