<?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: The trouble with getBounds()</title>
	<atom:link href="http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/feed/" rel="self" type="application/rss+xml" />
	<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/</link>
	<description>David Barlia - Flash Developer / Designer / Animator</description>
	<lastBuildDate>Thu, 12 Jan 2012 01:53:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: y_nk</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-212</link>
		<dc:creator>y_nk</dc:creator>
		<pubDate>Thu, 22 Apr 2010 09:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-212</guid>
		<description>hello,

i tried this with 2 squares named &quot;test&quot; and &quot;masque&quot; in the IDE :

test.mask = masque;
test.scrollRect = new Rectangle(0, 0, 20, 20);

var real:Rectangle;

real = test.getRect(test)
		.intersection(test.mask.getRect(test))
		.intersection(test.scrollRect);

trace(real); (x=10, y=10, w=10, h=10)



i don&#039;t know if it looks like what you want</description>
		<content:encoded><![CDATA[<p>hello,</p>
<p>i tried this with 2 squares named &#8220;test&#8221; and &#8220;masque&#8221; in the IDE :</p>
<p>test.mask = masque;<br />
test.scrollRect = new Rectangle(0, 0, 20, 20);</p>
<p>var real:Rectangle;</p>
<p>real = test.getRect(test)<br />
		.intersection(test.mask.getRect(test))<br />
		.intersection(test.scrollRect);</p>
<p>trace(real); (x=10, y=10, w=10, h=10)</p>
<p>i don&#8217;t know if it looks like what you want</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-210</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Wed, 27 Jan 2010 00:04:18 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-210</guid>
		<description>Hi,
tkx for your code.
I took the BitmapData approach from colin and made a function that works with DisplayObject whose upper left corner is not at 0,0. It returns a Rectangle object too.

http://blog.open-design.be/2010/01/26/getbounds-on-displayobject-not-functioning-properly/</description>
		<content:encoded><![CDATA[<p>Hi,<br />
tkx for your code.<br />
I took the BitmapData approach from colin and made a function that works with DisplayObject whose upper left corner is not at 0,0. It returns a Rectangle object too.</p>
<p><a href="http://blog.open-design.be/2010/01/26/getbounds-on-displayobject-not-functioning-properly/" rel="nofollow">http://blog.open-design.be/2010/01/26/getbounds-on-displayobject-not-functioning-properly/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: getBounds() on DisplayObject not functioning properly &#124; Down the Rabbit Hole</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-209</link>
		<dc:creator>getBounds() on DisplayObject not functioning properly &#124; Down the Rabbit Hole</dc:creator>
		<pubDate>Tue, 26 Jan 2010 21:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-209</guid>
		<description>[...] During my search, I found a post from David Barlia: http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/ [...]</description>
		<content:encoded><![CDATA[<p>[...] During my search, I found a post from David Barlia: <a href="http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/" rel="nofollow">http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-202</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Thu, 15 Oct 2009 08:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-202</guid>
		<description>this saved me a lot of time and frustration, thanks David!</description>
		<content:encoded><![CDATA[<p>this saved me a lot of time and frustration, thanks David!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barliesque</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-8</link>
		<dc:creator>barliesque</dc:creator>
		<pubDate>Mon, 10 Nov 2008 06:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-8</guid>
		<description>Thanks for dropping by Colin.

That&#039;s an approach to the problem I hadn&#039;t considered.  Looks like a pretty reliable method without the problem of having to reconstruct masks in code.  Nice!  I only wonder if the performance hit of pre-rendering the MovieClip makes it usable on a frame-by-frame basis.</description>
		<content:encoded><![CDATA[<p>Thanks for dropping by Colin.</p>
<p>That&#8217;s an approach to the problem I hadn&#8217;t considered.  Looks like a pretty reliable method without the problem of having to reconstruct masks in code.  Nice!  I only wonder if the performance hit of pre-rendering the MovieClip makes it usable on a frame-by-frame basis.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: colin</title>
		<link>http://studio.barliesque.com/blog/2008/10/the-trouble-with-getbounds/#comment-7</link>
		<dc:creator>colin</dc:creator>
		<pubDate>Sun, 09 Nov 2008 05:03:40 +0000</pubDate>
		<guid isPermaLink="false">http://studio.barliesque.com/blog/?p=6#comment-7</guid>
		<description>hey david,
you could use a bitmap to check the real dimensions. too bad actionscript doesn&#039;t provide something built-in. here&#039;s a simple example:

&lt;pre lang=&quot;actionscript3&quot;&gt;package {
  import flash.display.*;
  import flash.geom.ColorTransform;
  import flash.geom.Rectangle;
  import flash.text.TextField;

  public class Test extends Sprite {
    private var t:TextField;
    private var m:Shape;
    
    public function Test () {
      t = new TextField();
      t.background = true;
      t.backgroundColor = 0x00FF00;
      t.text = &quot;Hi there&quot;;
      
      m = new Shape();
      m.graphics.beginFill(0x000000);
      m.graphics.drawRect(0, 0, 15, 25);
      
      addChild(t);
      addChild(m);
      t.mask = m;
      
      trace(t.height);  // 100 (not 25)
      trace(getVisibleHeight(t));
    }
    
    public function getVisibleHeight (o:DisplayObject):Number {
      var bounds:Rectangle;
      var bitmapData:BitmapData = new BitmapData(o.width, o.height, true, 0);
      bitmapData.draw(o, null, new ColorTransform( 1, 1, 1, 1, 255, -255, -255, 255 ) );
      bounds = bitmapData.getColorBoundsRect( 0xFF000000, 0xFF000000 );
      bitmapData.dispose(); 
      return bounds.y + bounds.height;
    }
  }
}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>hey david,<br />
you could use a bitmap to check the real dimensions. too bad actionscript doesn&#8217;t provide something built-in. here&#8217;s a simple example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.*;</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ColorTransform</span><span style="color: #000066; font-weight: bold;">;</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TextField</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Test <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> t<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TextField</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> m<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Shape</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Test <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
      t = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      t<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">background</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
      t<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">backgroundColor</span> = 0x00FF00<span style="color: #000066; font-weight: bold;">;</span>
      t<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Hi there&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
      m = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Shape</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      m<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x000000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      m<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">15</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">25</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
      <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>t<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      t<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mask</span> = m<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
      <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>t<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>  <span style="color: #009900; font-style: italic;">// 100 (not 25)</span>
      <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>getVisibleHeight<span style="color: #000000;">&#40;</span>t<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> getVisibleHeight <span style="color: #000000;">&#40;</span>o<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000066; 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> bounds<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span>
      <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">bitmapData</span><span style="color: #000066; 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>o<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> o<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      <span style="color: #004993;">bitmapData</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>o<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">ColorTransform</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">255</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">255</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">255</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">255</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      bounds = <span style="color: #004993;">bitmapData</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getColorBoundsRect</span><span style="color: #000000;">&#40;</span> 0xFF000000<span style="color: #000066; font-weight: bold;">,</span> 0xFF000000 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
      <span style="color: #004993;">bitmapData</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
      <span style="color: #0033ff; font-weight: bold;">return</span> bounds<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span> bounds<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">;</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>
</channel>
</rss>

