<?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: Scale Any DisplayObject with My &#8216;ScaleObject&#8217; Class</title>
	<atom:link href="http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/</link>
	<description>The day to day blog of Ahmed Nuaman, Freelance Designer and Developer</description>
	<lastBuildDate>Thu, 18 Feb 2010 22:41:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ScaleObject: Quick fix for scale-9 issues - Troy Gilbert</title>
		<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/comment-page-1/#comment-176</link>
		<dc:creator>ScaleObject: Quick fix for scale-9 issues - Troy Gilbert</dc:creator>
		<pubDate>Wed, 26 Aug 2009 17:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://ahmednuaman.com/blog/?p=210#comment-176</guid>
		<description>[...] Scale Any DisplayObject with My â€˜ScaleObjectâ€™ Class [...]</description>
		<content:encoded><![CDATA[<p>[...] Scale Any DisplayObject with My â€˜ScaleObjectâ€™ Class [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed</title>
		<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/comment-page-1/#comment-159</link>
		<dc:creator>Ahmed</dc:creator>
		<pubDate>Fri, 21 Aug 2009 17:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://ahmednuaman.com/blog/?p=210#comment-159</guid>
		<description>Thanks Troy! Sorry about the external classes, I like to keep things split and what not.</description>
		<content:encoded><![CDATA[<p>Thanks Troy! Sorry about the external classes, I like to keep things split and what not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Gilbert</title>
		<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/comment-page-1/#comment-158</link>
		<dc:creator>Troy Gilbert</dc:creator>
		<pubDate>Fri, 21 Aug 2009 17:32:34 +0000</pubDate>
		<guid isPermaLink="false">http://ahmednuaman.com/blog/?p=210#comment-158</guid>
		<description>Forgot to say: it&#039;s a bit more efficient in-memory, on the display list, and in construction time. It&#039;s also completely self-contained (no external bitmap utils class).</description>
		<content:encoded><![CDATA[<p>Forgot to say: it&#8217;s a bit more efficient in-memory, on the display list, and in construction time. It&#8217;s also completely self-contained (no external bitmap utils class).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Gilbert</title>
		<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/comment-page-1/#comment-157</link>
		<dc:creator>Troy Gilbert</dc:creator>
		<pubDate>Fri, 21 Aug 2009 17:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://ahmednuaman.com/blog/?p=210#comment-157</guid>
		<description>Thanks for the class... I tweaked it a bit to get this:
&lt;code lang=&quot;actionscript&quot;&gt;
class ScaleObject extends Sprite
{
	/** Scale9grid pieces. **/
	private var _tl:Bitmap;
	private var _tc:Bitmap;
	private var _tr:Bitmap;
	private var _ml:Bitmap;
	private var _mc:Bitmap;
	private var _mr:Bitmap;
	private var _bl:Bitmap;
	private var _bc:Bitmap;
	private var _br:Bitmap;
	
	/** Constructor. **/
	public function ScaleObject(original:DisplayObject, scaleGrid:Rectangle)
	{
		_tl = slice(original, 0, 0, scaleGrid.left, scaleGrid.top);
		_tc = slice(original, scaleGrid.left, 0, scaleGrid.width, scaleGrid.top);
		_tr = slice(original, scaleGrid.right, 0, original.width - scaleGrid.right, scaleGrid.top);
		
		_ml = slice(original, 0, scaleGrid.top, scaleGrid.left, scaleGrid.height);
		_mc = slice(original, scaleGrid.left, scaleGrid.top, scaleGrid.width, scaleGrid.height);
		_mr = slice(original, scaleGrid.right, scaleGrid.top, original.width - scaleGrid.right, scaleGrid.height);
		
		_bl = slice(original, 0, scaleGrid.bottom, scaleGrid.left, original.height - scaleGrid.bottom);
		_bc = slice(original, scaleGrid.left, scaleGrid.bottom, scaleGrid.width, original.height - scaleGrid.bottom);
		_br = slice(original, scaleGrid.right, scaleGrid.bottom, original.width - scaleGrid.right, original.height - scaleGrid.bottom);
	}
	
	/** Create a slice. **/
	private function slice(original:DisplayObject, x:Number, y:Number, width:Number, height:Number):Bitmap
	{
		// render a slice of the original
		var bd:BitmapData = new BitmapData(width, height, true, 0);
		bd.draw(original, new Matrix(1, 0, 0, 1, -x, -y));
		
		// create and position the bitmap
		var bitmap:Bitmap = new Bitmap(bd, PixelSnapping.AUTO, true);
		bitmap.x = x;
		bitmap.y = y;
		addChild(bitmap);
		
		return bitmap;
	}
	
	/** Width. **/
	override public function set width(value:Number):void
	{
		_tc.width = _mc.width = _bc.width = value - _tl.width - _tr.width;
		_tr.x = _mr.x = _br.x = value - _tr.width;
	}
	
	/** Height. **/
	override public function set height(value:Number):void
	{
		_ml.height = _mc.height = _mr.height = value - _tl.height - _bl.height;
		_bl.y = _bc.y = _br.y = value - _bl.height;
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for the class&#8230; I tweaked it a bit to get this:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:600px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> ScaleObject <span style="color: #0066CC;">extends</span> Sprite<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Scale9grid pieces. **/</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _tl:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _tc:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _tr:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _ml:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _mc:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _mr:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bl:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bc:Bitmap;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _br:Bitmap;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Constructor. **/</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ScaleObject<span style="color: #66cc66;">&#40;</span>original:DisplayObject, scaleGrid:Rectangle<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _tl = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, 0, 0, scaleGrid.<span style="color: #0066CC;">left</span>, scaleGrid.<span style="color: #006600;">top</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _tc = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">left</span>, 0, scaleGrid.<span style="color: #0066CC;">width</span>, scaleGrid.<span style="color: #006600;">top</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _tr = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">right</span>, 0, original.<span style="color: #0066CC;">width</span> - scaleGrid.<span style="color: #0066CC;">right</span>, scaleGrid.<span style="color: #006600;">top</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; _ml = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, 0, scaleGrid.<span style="color: #006600;">top</span>, scaleGrid.<span style="color: #0066CC;">left</span>, scaleGrid.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _mc = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">left</span>, scaleGrid.<span style="color: #006600;">top</span>, scaleGrid.<span style="color: #0066CC;">width</span>, scaleGrid.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _mr = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">right</span>, scaleGrid.<span style="color: #006600;">top</span>, original.<span style="color: #0066CC;">width</span> - scaleGrid.<span style="color: #0066CC;">right</span>, scaleGrid.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; _bl = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, 0, scaleGrid.<span style="color: #006600;">bottom</span>, scaleGrid.<span style="color: #0066CC;">left</span>, original.<span style="color: #0066CC;">height</span> - scaleGrid.<span style="color: #006600;">bottom</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _bc = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">left</span>, scaleGrid.<span style="color: #006600;">bottom</span>, scaleGrid.<span style="color: #0066CC;">width</span>, original.<span style="color: #0066CC;">height</span> - scaleGrid.<span style="color: #006600;">bottom</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _br = <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original, scaleGrid.<span style="color: #0066CC;">right</span>, scaleGrid.<span style="color: #006600;">bottom</span>, original.<span style="color: #0066CC;">width</span> - scaleGrid.<span style="color: #0066CC;">right</span>, original.<span style="color: #0066CC;">height</span> - scaleGrid.<span style="color: #006600;">bottom</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Create a slice. **/</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span>original:DisplayObject, x:<span style="color: #0066CC;">Number</span>, y:<span style="color: #0066CC;">Number</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>:Bitmap<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// render a slice of the original</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bd:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span>, 0<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bd.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>original, <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span>1, 0, 0, 1, -x, -y<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create and position the bitmap</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bitmap:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>bd, PixelSnapping.<span style="color: #006600;">AUTO</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bitmap.<span style="color: #006600;">x</span> = x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bitmap.<span style="color: #006600;">y</span> = y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>bitmap<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> bitmap;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Width. **/</span><br />
&nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> <span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _tc.<span style="color: #0066CC;">width</span> = _mc.<span style="color: #0066CC;">width</span> = _bc.<span style="color: #0066CC;">width</span> = value - _tl.<span style="color: #0066CC;">width</span> - _tr.<span style="color: #0066CC;">width</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _tr.<span style="color: #006600;">x</span> = _mr.<span style="color: #006600;">x</span> = _br.<span style="color: #006600;">x</span> = value - _tr.<span style="color: #0066CC;">width</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Height. **/</span><br />
&nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> <span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _ml.<span style="color: #0066CC;">height</span> = _mc.<span style="color: #0066CC;">height</span> = _mr.<span style="color: #0066CC;">height</span> = value - _tl.<span style="color: #0066CC;">height</span> - _bl.<span style="color: #0066CC;">height</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; _bl.<span style="color: #006600;">y</span> = _bc.<span style="color: #006600;">y</span> = _br.<span style="color: #006600;">y</span> = value - _bl.<span style="color: #0066CC;">height</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed</title>
		<link>http://ahmednuaman.com/blog/2009/06/26/scale-any-displayobject-with-my-scaleobject-class/comment-page-1/#comment-128</link>
		<dc:creator>Ahmed</dc:creator>
		<pubDate>Mon, 20 Jul 2009 17:28:19 +0000</pubDate>
		<guid isPermaLink="false">http://ahmednuaman.com/blog/?p=210#comment-128</guid>
		<description>I&#039;m glad you like it, spread the word!</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad you like it, spread the word!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
