<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
	>
<channel>
	<title>Comments on: Tutorial: Understanding Classes in AS3 Part 3</title>
	<atom:link href="http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/</link>
	<description>We Make Flash Games</description>
	<lastBuildDate>Fri, 10 Feb 2012 03:01:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Malono</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-8276</link>
		<dc:creator>Malono</dc:creator>
		<pubDate>Thu, 02 Jun 2011 11:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-8276</guid>
		<description>Hi,
Experimenting with classes found your tutorials and  did this with it. Please shoot on it. Why its better , or why its worse. Trying to learn classapproach.

package
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
 
	public class Main extends MovieClip
	{
		
		public function Main()
		{
			// Instantiate a new play button:
			var myPlayButton:MovieClip = new MyButton(&quot;Play&quot;,0,89);
			addChild(myPlayButton);
 
			// Instantiate a new instructions button:
			var myInstructionsButton:MovieClip = new MyButton(&quot;Instructions&quot;,200,89);
			addChild(myInstructionsButton);
 
			// Instantiate a new credits button:
			var myCreditsButton:MovieClip = new MyButton(&quot;Credits&quot;,400,89);
			addChild(myCreditsButton);

		}
	}
}

//MyButton Class
package
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
 
	public class MyButton extends MovieClip
	{
		public function MyButton(labelName:String, xPosition:int, yPosition:int)
		{
			label_txt.text = labelName; // Grab that parameter and label myself!
			 x = xPosition;
			 y = yPosition;

			addEventListener(MouseEvent.MOUSE_OVER, rollOverMyButton);
			addEventListener(MouseEvent.MOUSE_OUT, rollOutMyButton);
			this.name = labelName;
				
			
			if (name == &quot;Play&quot;) {
				addEventListener(MouseEvent.CLICK, clickBtnPlay);
			}
			else if (name == &quot;Instructions&quot;) {
				addEventListener(MouseEvent.CLICK, clickBtnInstructions);
			}
			else {
				addEventListener(MouseEvent.CLICK, clickBtnCredits);
			}
			
		}
 
		public function rollOverMyButton(e:Event = null):void
		{
			gotoAndStop(&quot;highlight&quot;);
		}
 
		public function rollOutMyButton(e:Event = null):void
		{
			gotoAndStop(&quot;unhighlight&quot;);
		}
		public function clickBtnPlay(e:Event):void
		{
			// Play the game
			trace(&quot;Play the game&quot;);
		}
 
		public function clickBtnInstructions(e:Event):void
		{
			// Show the instructions
			trace(&quot;Show the instructions&quot;);
		}
 
		public function clickBtnCredits(e:Event):void
		{
			// Show the credits
			trace(&quot;Show the credits&quot;);
		}
 
	}
}

Tried to make it more generic by adding the function as a 4th parameter, failed though. Tried to pass it as String and then converting the received String to a function....
Something like this in myButton class...
var myStringConvertedToFunction:Function = function(clickFunction);
But couldnt get that working...

Regards,
Malono</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Experimenting with classes found your tutorials and  did this with it. Please shoot on it. Why its better , or why its worse. Trying to learn classapproach.</p>
<p>package<br />
{<br />
	import flash.display.MovieClip;<br />
	import flash.events.Event;<br />
	import flash.events.MouseEvent;</p>
<p>	public class Main extends MovieClip<br />
	{</p>
<p>		public function Main()<br />
		{<br />
			// Instantiate a new play button:<br />
			var myPlayButton:MovieClip = new MyButton(&#8220;Play&#8221;,0,89);<br />
			addChild(myPlayButton);</p>
<p>			// Instantiate a new instructions button:<br />
			var myInstructionsButton:MovieClip = new MyButton(&#8220;Instructions&#8221;,200,89);<br />
			addChild(myInstructionsButton);</p>
<p>			// Instantiate a new credits button:<br />
			var myCreditsButton:MovieClip = new MyButton(&#8220;Credits&#8221;,400,89);<br />
			addChild(myCreditsButton);</p>
<p>		}<br />
	}<br />
}</p>
<p>//MyButton Class<br />
package<br />
{<br />
	import flash.display.MovieClip;<br />
	import flash.events.Event;<br />
	import flash.events.MouseEvent;</p>
<p>	public class MyButton extends MovieClip<br />
	{<br />
		public function MyButton(labelName:String, xPosition:int, yPosition:int)<br />
		{<br />
			label_txt.text = labelName; // Grab that parameter and label myself!<br />
			 x = xPosition;<br />
			 y = yPosition;</p>
<p>			addEventListener(MouseEvent.MOUSE_OVER, rollOverMyButton);<br />
			addEventListener(MouseEvent.MOUSE_OUT, rollOutMyButton);<br />
			this.name = labelName;</p>
<p>			if (name == &#8220;Play&#8221;) {<br />
				addEventListener(MouseEvent.CLICK, clickBtnPlay);<br />
			}<br />
			else if (name == &#8220;Instructions&#8221;) {<br />
				addEventListener(MouseEvent.CLICK, clickBtnInstructions);<br />
			}<br />
			else {<br />
				addEventListener(MouseEvent.CLICK, clickBtnCredits);<br />
			}</p>
<p>		}</p>
<p>		public function rollOverMyButton(e:Event = null):void<br />
		{<br />
			gotoAndStop(&#8220;highlight&#8221;);<br />
		}</p>
<p>		public function rollOutMyButton(e:Event = null):void<br />
		{<br />
			gotoAndStop(&#8220;unhighlight&#8221;);<br />
		}<br />
		public function clickBtnPlay(e:Event):void<br />
		{<br />
			// Play the game<br />
			trace(&#8220;Play the game&#8221;);<br />
		}</p>
<p>		public function clickBtnInstructions(e:Event):void<br />
		{<br />
			// Show the instructions<br />
			trace(&#8220;Show the instructions&#8221;);<br />
		}</p>
<p>		public function clickBtnCredits(e:Event):void<br />
		{<br />
			// Show the credits<br />
			trace(&#8220;Show the credits&#8221;);<br />
		}</p>
<p>	}<br />
}</p>
<p>Tried to make it more generic by adding the function as a 4th parameter, failed though. Tried to pass it as String and then converting the received String to a function&#8230;.<br />
Something like this in myButton class&#8230;<br />
var myStringConvertedToFunction:Function = function(clickFunction);<br />
But couldnt get that working&#8230;</p>
<p>Regards,<br />
Malono</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Henson Creighton</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-7441</link>
		<dc:creator>Ryan Henson Creighton</dc:creator>
		<pubDate>Thu, 10 Feb 2011 01:12:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-7441</guid>
		<description>No problem, Luthimir - i usually go in to readers&#039; comments and add the formatting for them.

When you set the value of a parameter, you&#039;re creating an &quot;optional argument&quot;.  It&#039;s a way of setting a param to a default value if nothing gets passed in.  Say, for example, you had this method:

&lt;pre lang=&quot;actionscript&quot;&gt;
private function eatSomeWieners(numberOfWieners:int = 2)
{
}
&lt;/pre&gt;

Both of these calls will now work:

&lt;pre lang=&quot;actionscript&quot;&gt;
eatSomeWieners(57);
eatSomeWieners();
&lt;/pre&gt;

Normally, if a method wants an argument, you gotta pass it an argument.  But note that if we have an optional argument, you don&#039;t have to.  Keep in mind that if you use these optional arguments, ALL of your optional arguments have to be listed in the method signature AFTER all of the compulsory arguments.

So e:Event=null enables us to just fire the button click function without having to pass it an event.  Maybe you want to do what the button does, but it&#039;s not in response to a user&#039;s click?  That&#039;s what that&#039;s all about.</description>
		<content:encoded><![CDATA[<p>No problem, Luthimir &#8211; i usually go in to readers&#8217; comments and add the formatting for them.</p>
<p>When you set the value of a parameter, you&#8217;re creating an &#8220;optional argument&#8221;.  It&#8217;s a way of setting a param to a default value if nothing gets passed in.  Say, for example, you had this method:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> eatSomeWieners<span style="color: #66cc66;">&#40;</span>numberOfWieners:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Both of these calls will now work:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">eatSomeWieners<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">57</span><span style="color: #66cc66;">&#41;</span>;
eatSomeWieners<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Normally, if a method wants an argument, you gotta pass it an argument.  But note that if we have an optional argument, you don&#8217;t have to.  Keep in mind that if you use these optional arguments, ALL of your optional arguments have to be listed in the method signature AFTER all of the compulsory arguments.</p>
<p>So e:Event=null enables us to just fire the button click function without having to pass it an event.  Maybe you want to do what the button does, but it&#8217;s not in response to a user&#8217;s click?  That&#8217;s what that&#8217;s all about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luthimir</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-7440</link>
		<dc:creator>Luthimir</dc:creator>
		<pubDate>Thu, 10 Feb 2011 01:04:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-7440</guid>
		<description>My first thought upon reading this was that you could also incorporate one listener for all of your buttons:

&lt;pre lang=&quot;actionscript&quot;&gt;
//in Main function
myPlayButton.addEventListener(MouseEvent.CLICK, clickBtn);
myInstructionsButton.addEventListener(MouseEvent.CLICK, clickBtn);
myCreditsButton.addEventListener(MouseEvent.CLICK, clickBtn);

//clickBtn function checks for event target
public function clickBtn(event:Event):void
{
	switch (event.target)
	{
		case myPlayButton:
                          //play game stuff
                          break;
                case myInstructionsButton:
                          //etc...
	}

}
&lt;/pre&gt;

A question - why do you use e:Event = null? I am not familiar with this concept, I&#039;ve always used the technique I posted above (event:Event... without the = null).
(Side note, not familiar with how to format my code on this site, sorry if it&#039;s hard to read)</description>
		<content:encoded><![CDATA[<p>My first thought upon reading this was that you could also incorporate one listener for all of your buttons:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//in Main function</span>
myPlayButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickBtn<span style="color: #66cc66;">&#41;</span>;
myInstructionsButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickBtn<span style="color: #66cc66;">&#41;</span>;
myCreditsButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickBtn<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//clickBtn function checks for event target</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clickBtn<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">case</span> myPlayButton:
                          <span style="color: #808080; font-style: italic;">//play game stuff</span>
                          <span style="color: #b1b100;">break</span>;
                <span style="color: #b1b100;">case</span> myInstructionsButton:
                          <span style="color: #808080; font-style: italic;">//etc...</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>A question &#8211; why do you use e:Event = null? I am not familiar with this concept, I&#8217;ve always used the technique I posted above (event:Event&#8230; without the = null).<br />
(Side note, not familiar with how to format my code on this site, sorry if it&#8217;s hard to read)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BJPcommunication.com&#187; Archives &#187; Tutorial sur les classes AS3 et la POO</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4966</link>
		<dc:creator>BJPcommunication.com&#187; Archives &#187; Tutorial sur les classes AS3 et la POO</dc:creator>
		<pubDate>Mon, 18 Jan 2010 17:06:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4966</guid>
		<description>[...] http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/" rel="nofollow">http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David of Neptronix</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4894</link>
		<dc:creator>David of Neptronix</dc:creator>
		<pubDate>Tue, 05 Jan 2010 19:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4894</guid>
		<description>Oh dude, thanks a bunch for putting this up. I am making the leap from actionscript 2 to 3 and have found your tutorials extremely useful. I feel like i get it, whereas everything else i&#039;ve read kind of kept me in the dark..</description>
		<content:encoded><![CDATA[<p>Oh dude, thanks a bunch for putting this up. I am making the leap from actionscript 2 to 3 and have found your tutorials extremely useful. I feel like i get it, whereas everything else i&#8217;ve read kind of kept me in the dark..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AntiFaith</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4804</link>
		<dc:creator>AntiFaith</dc:creator>
		<pubDate>Thu, 10 Dec 2009 22:46:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4804</guid>
		<description>sweet - cheers man!</description>
		<content:encoded><![CDATA[<p>sweet &#8211; cheers man!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4803</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Thu, 10 Dec 2009 22:41:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4803</guid>
		<description>AntiFaith - it&#039;s not really meant to be a cut n&#039; paste practical exercise.  It&#039;s more theoretical, because the code&#039;s not that interesting.  

You&#039;re getting that error because you don&#039;t have a MovieClip class in your library called MyButton with a dynamic text field inside it with the instance name &quot;label_txt&quot;.  i copy/pasted the code and ironed out a few type-os, then added &quot;myButton.mouseChildren = false&quot; to prevent an error in that initial block of code.  Everything should work now.</description>
		<content:encoded><![CDATA[<p>AntiFaith &#8211; it&#8217;s not really meant to be a cut n&#8217; paste practical exercise.  It&#8217;s more theoretical, because the code&#8217;s not that interesting.  </p>
<p>You&#8217;re getting that error because you don&#8217;t have a MovieClip class in your library called MyButton with a dynamic text field inside it with the instance name &#8220;label_txt&#8221;.  i copy/pasted the code and ironed out a few type-os, then added &#8220;myButton.mouseChildren = false&#8221; to prevent an error in that initial block of code.  Everything should work now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AntiFaith</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4802</link>
		<dc:creator>AntiFaith</dc:creator>
		<pubDate>Thu, 10 Dec 2009 22:17:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4802</guid>
		<description>Thanks for this explanation of classes - its helping me get my head around them a lot quicker than i would have, so much Kudos! However i&#039;ve got a minor problem...

i&#039;ve set this up by copying and pasting your code straight into flash - sorted out a couple of errors within it - yet when i Test the Movie it says access of undefined property label_txt which is just a pain in the arse tbh lol any ideas? Bearing in mind my code is pretty much EXACTLY the same as yours lol - thanks for any help bro</description>
		<content:encoded><![CDATA[<p>Thanks for this explanation of classes &#8211; its helping me get my head around them a lot quicker than i would have, so much Kudos! However i&#8217;ve got a minor problem&#8230;</p>
<p>i&#8217;ve set this up by copying and pasting your code straight into flash &#8211; sorted out a couple of errors within it &#8211; yet when i Test the Movie it says access of undefined property label_txt which is just a pain in the arse tbh lol any ideas? Bearing in mind my code is pretty much EXACTLY the same as yours lol &#8211; thanks for any help bro</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4797</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Thu, 10 Dec 2009 15:22:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4797</guid>
		<description>Thanks, Sbliss!  Which areas of AS3 would you like to see covered?</description>
		<content:encoded><![CDATA[<p>Thanks, Sbliss!  Which areas of AS3 would you like to see covered?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sbliss</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4796</link>
		<dc:creator>Sbliss</dc:creator>
		<pubDate>Thu, 10 Dec 2009 15:03:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4796</guid>
		<description>Ryan

Thumps up. This is good stuff. Bring us more of it, perhaps covering other areas of AS3 as well. Thanx.

sbliss</description>
		<content:encoded><![CDATA[<p>Ryan</p>
<p>Thumps up. This is good stuff. Bring us more of it, perhaps covering other areas of AS3 as well. Thanx.</p>
<p>sbliss</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: No0B</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4579</link>
		<dc:creator>No0B</dc:creator>
		<pubDate>Fri, 06 Nov 2009 18:11:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4579</guid>
		<description>Thanks for the explanation Ryan, great stuff.

I guess it&#039;s like Photoshop, where there are many ways to do the same thing but each has it&#039;s own subtle purpose; easy to get confused for beginners, but it will slowly make sense :)

As a side note, may i ask you what you think of Flex Builder 3? Is it better to use Flash IDE for graphics and Flash Develop for AS3 OR do it all in Flex Builder, which seems a bit clunky and is a Visual Studio rip-off. BTW, VS is the best IDE on the market, simply superb for C#, VB, C++ development.</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation Ryan, great stuff.</p>
<p>I guess it&#8217;s like Photoshop, where there are many ways to do the same thing but each has it&#8217;s own subtle purpose; easy to get confused for beginners, but it will slowly make sense :)</p>
<p>As a side note, may i ask you what you think of Flex Builder 3? Is it better to use Flash IDE for graphics and Flash Develop for AS3 OR do it all in Flex Builder, which seems a bit clunky and is a Visual Studio rip-off. BTW, VS is the best IDE on the market, simply superb for C#, VB, C++ development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4563</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Fri, 06 Nov 2009 02:47:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4563</guid>
		<description>Thanks so much, NoOB.  There are three places where you can identify MovieClips, and it&#039;s crucial to know the difference:


The SYMBOL NAME in the library. This is when you punch F8 or &quot;Convert to MovieClip&quot; and are asked to enter a name.  This is how the symbol is identified in the Library.  This name is FOR YOUR EYES ONLY.  Actionscript cannot see this name or do anything with it.  When i work with students, i like to use &quot;monkey butt&#039; or something similarly ridiculous just to emphasize that this name is not important to your code.
The INSTANCE NAME.  Since you can drag numerous copies of your monkey butt symbol out of the library and onto the stage, we need to give each one a name on the stage so that we can refer to them with code.  A typical example is &quot;ball0&quot;, &quot;ball1&quot;, &quot;ball2&quot; etc. 
The LINKAGE NAME.  We don&#039;t have to &quot;physically&quot; drag an instance of a symbol out of the library - we can do it with code.  But like we said, code can&#039;t see our linkage name &quot;monkey butt&quot;.  We have to give the symbol a special linkage name or tag so that we can refer to things in the library via code.


This is a very easy place to get tripped up when you&#039;re just starting out.  Be aware of these THREE ways of naming, and the difference between each, and you&#039;ll be a big step ahead.

Go forth and code.</description>
		<content:encoded><![CDATA[<p>Thanks so much, NoOB.  There are three places where you can identify MovieClips, and it&#8217;s crucial to know the difference:</p>
<p>The SYMBOL NAME in the library. This is when you punch F8 or &#8220;Convert to MovieClip&#8221; and are asked to enter a name.  This is how the symbol is identified in the Library.  This name is FOR YOUR EYES ONLY.  Actionscript cannot see this name or do anything with it.  When i work with students, i like to use &#8220;monkey butt&#8217; or something similarly ridiculous just to emphasize that this name is not important to your code.<br />
The INSTANCE NAME.  Since you can drag numerous copies of your monkey butt symbol out of the library and onto the stage, we need to give each one a name on the stage so that we can refer to them with code.  A typical example is &#8220;ball0&#8243;, &#8220;ball1&#8243;, &#8220;ball2&#8243; etc.<br />
The LINKAGE NAME.  We don&#8217;t have to &#8220;physically&#8221; drag an instance of a symbol out of the library &#8211; we can do it with code.  But like we said, code can&#8217;t see our linkage name &#8220;monkey butt&#8221;.  We have to give the symbol a special linkage name or tag so that we can refer to things in the library via code.</p>
<p>This is a very easy place to get tripped up when you&#8217;re just starting out.  Be aware of these THREE ways of naming, and the difference between each, and you&#8217;ll be a big step ahead.</p>
<p>Go forth and code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: No0B</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4562</link>
		<dc:creator>No0B</dc:creator>
		<pubDate>Fri, 06 Nov 2009 01:40:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4562</guid>
		<description>That very last comment Ryan is crucial and perhaps it should be in bold to emphasise its importance to beginners.

&quot;As long as those button clips have instance names, you’re good to go.&quot;

By giving movieClips an instance, they are accessible by the doc class WITHOUT declaring them using:

var mySquare:MySquare= new MySquare();

Instead you can just use MySquare.x=300; for example straight off the bat, because the stage already has an instance and the complier knows it&#039;s alive and breathing OOP rocket fuel.

Hope i&#039;m right, as i&#039;m just learning AS3 myself and your tuts are EXCELLENT :))))))))))))))))))))))

Thank you.</description>
		<content:encoded><![CDATA[<p>That very last comment Ryan is crucial and perhaps it should be in bold to emphasise its importance to beginners.</p>
<p>&#8220;As long as those button clips have instance names, you’re good to go.&#8221;</p>
<p>By giving movieClips an instance, they are accessible by the doc class WITHOUT declaring them using:</p>
<p>var mySquare:MySquare= new MySquare();</p>
<p>Instead you can just use MySquare.x=300; for example straight off the bat, because the stage already has an instance and the complier knows it&#8217;s alive and breathing OOP rocket fuel.</p>
<p>Hope i&#8217;m right, as i&#8217;m just learning AS3 myself and your tuts are EXCELLENT :))))))))))))))))))))))</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4429</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Mon, 19 Oct 2009 14:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4429</guid>
		<description>fallenSkillz() - the good news is that no, you don&#039;t have to link every single clip in your library - just the ones that sorta go hand-in-hand with the Classes you&#039;ve written.  So imagine you have a ControlPanel Class that describes the actions of some play/pause/stop/mute buttons, and you make a Clip in your library called ControlPanel.  The ControlPanel movieclip has movieclips inside it - btnPlay, btnPause, btnStop and btnMute.  You add the linkage name &quot;ControlPanel&quot; to the ControlPanel clip in your library.

When you say this:

&lt;pre lang=&quot;actionscript&quot;&gt;
// This is some code you&#039;d write somewhere OUTSIDE the ControlPanel Class:
var myControlPanel:ControlPanel = new ControlPanel();
addChild(myControlPanel);
&lt;/pre&gt;

... you not only get an instance of your ControlPanel movieclip from the library on your stage, but it&#039;s also being controlled by the ControlPanel Class that you wrote.

You DON&#039;T have to give linkage names to btnPlay, btnStop and all the others.  They&#039;re nested inside the ControlPanel clip.  The ControlPanel Class can just talk to them, because it&#039;s sorta been &lt;em&gt;glued&lt;/em&gt; to the ControlPanel clip.

&lt;pre lang=&quot;actionscript&quot;&gt;
// This is some code you&#039;d write INSIDE the ControlPanel Class:
btnPlay.addEventListener(MouseEvent.CLICK, doPlay);
btnStop.visible = false;
&lt;/pre&gt;

As long as those button clips have instance names, you&#039;re good to go.

Did that answer your question?</description>
		<content:encoded><![CDATA[<p>fallenSkillz() &#8211; the good news is that no, you don&#8217;t have to link every single clip in your library &#8211; just the ones that sorta go hand-in-hand with the Classes you&#8217;ve written.  So imagine you have a ControlPanel Class that describes the actions of some play/pause/stop/mute buttons, and you make a Clip in your library called ControlPanel.  The ControlPanel movieclip has movieclips inside it &#8211; btnPlay, btnPause, btnStop and btnMute.  You add the linkage name &#8220;ControlPanel&#8221; to the ControlPanel clip in your library.</p>
<p>When you say this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// This is some code you'd write somewhere OUTSIDE the ControlPanel Class:</span>
<span style="color: #000000; font-weight: bold;">var</span> myControlPanel:ControlPanel = <span style="color: #000000; font-weight: bold;">new</span> ControlPanel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>myControlPanel<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>&#8230; you not only get an instance of your ControlPanel movieclip from the library on your stage, but it&#8217;s also being controlled by the ControlPanel Class that you wrote.</p>
<p>You DON&#8217;T have to give linkage names to btnPlay, btnStop and all the others.  They&#8217;re nested inside the ControlPanel clip.  The ControlPanel Class can just talk to them, because it&#8217;s sorta been <em>glued</em> to the ControlPanel clip.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// This is some code you'd write INSIDE the ControlPanel Class:</span>
btnPlay.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, doPlay<span style="color: #66cc66;">&#41;</span>;
btnStop.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;</pre></div></div>

<p>As long as those button clips have instance names, you&#8217;re good to go.</p>
<p>Did that answer your question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fallenSkillz()</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4425</link>
		<dc:creator>fallenSkillz()</dc:creator>
		<pubDate>Sun, 18 Oct 2009 23:57:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4425</guid>
		<description>Wow, I&#039;m still stuck in the monkey evolution era...Soooh do I need to do this for every  moviEcliP on my lybrary?? (just ignore me still learning how to write &quot; (); &quot; Oh and by the way your tutorials are funny, laughter and learning is the shitznitzz . I enjoyed reading it..and I like your site design...carry on ..ThankYou();</description>
		<content:encoded><![CDATA[<p>Wow, I&#8217;m still stuck in the monkey evolution era&#8230;Soooh do I need to do this for every  moviEcliP on my lybrary?? (just ignore me still learning how to write &#8221; (); &#8221; Oh and by the way your tutorials are funny, laughter and learning is the shitznitzz . I enjoyed reading it..and I like your site design&#8230;carry on ..ThankYou();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Social</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4237</link>
		<dc:creator>Social</dc:creator>
		<pubDate>Tue, 29 Sep 2009 14:45:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4237</guid>
		<description>aaaaah, ok. So I&#039;m not crazy just yet...</description>
		<content:encoded><![CDATA[<p>aaaaah, ok. So I&#8217;m not crazy just yet&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4236</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Tue, 29 Sep 2009 14:44:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4236</guid>
		<description>Social - IMO, that&#039;s not &quot;wrong&quot; at all.  It&#039;s a very valid approach, especially if you want to smoosh your code a little.</description>
		<content:encoded><![CDATA[<p>Social &#8211; IMO, that&#8217;s not &#8220;wrong&#8221; at all.  It&#8217;s a very valid approach, especially if you want to smoosh your code a little.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Social</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4234</link>
		<dc:creator>Social</dc:creator>
		<pubDate>Tue, 29 Sep 2009 14:37:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4234</guid>
		<description>When you say:

&quot; Main.as should take care of positioning the button instance. &quot;

Why can&#039;t you do something like this:

In the button class:
public function AppButton(LabelText:String,Xposition:Number,Yposition:Number) 

and then in the Main function:
var stop_Button:MovieClip = new AppButton(&quot;Stop&quot;,150,50);

Is that wrong?</description>
		<content:encoded><![CDATA[<p>When you say:</p>
<p>&#8221; Main.as should take care of positioning the button instance. &#8221;</p>
<p>Why can&#8217;t you do something like this:</p>
<p>In the button class:<br />
public function AppButton(LabelText:String,Xposition:Number,Yposition:Number) </p>
<p>and then in the Main function:<br />
var stop_Button:MovieClip = new AppButton(&#8220;Stop&#8221;,150,50);</p>
<p>Is that wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4208</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Sat, 26 Sep 2009 13:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4208</guid>
		<description>Logan - Pffft.  Sucks to your &quot;accuracy&quot;.  Thank God Flash has such a forgiving, mind-reading compiler.  ;)</description>
		<content:encoded><![CDATA[<p>Logan &#8211; Pffft.  Sucks to your &#8220;accuracy&#8221;.  Thank God Flash has such a forgiving, mind-reading compiler.  ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Logan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4204</link>
		<dc:creator>Logan</dc:creator>
		<pubDate>Sat, 26 Sep 2009 05:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4204</guid>
		<description>needs to be changed for myPlayButton and myInstructionsButton as well ;)</description>
		<content:encoded><![CDATA[<p>needs to be changed for myPlayButton and myInstructionsButton as well ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4200</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Sat, 26 Sep 2009 00:41:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4200</guid>
		<description>Logan - good catch!  You&#039;re absolutely right.  i&#039;ve updated the tutorial with your corrections.  Thanks so much!

- Ryan</description>
		<content:encoded><![CDATA[<p>Logan &#8211; good catch!  You&#8217;re absolutely right.  i&#8217;ve updated the tutorial with your corrections.  Thanks so much!</p>
<p>- Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Logan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4197</link>
		<dc:creator>Logan</dc:creator>
		<pubDate>Fri, 25 Sep 2009 21:17:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4197</guid>
		<description>is it correct to still be referring to myButton?

for example shouldn&#039;t this:

&lt;pre lang=&quot;actionscript&quot;&gt;
	// Instantiate a new credits button:
	var myCreditsButton:MovieClip = new MyButton(&quot;Credits&quot;);
	myCreditsButton.addEventListener(MouseEvent.CLICK, clickBtnCredits); // new line!
	addChild(myCreditsButton);
	myButton.x = 340;
	myButton.y = 89;
&lt;/pre&gt;

actually be changed to this?:

&lt;pre lang=&quot;actionscript&quot;&gt;
	// Instantiate a new credits button:
	var myCreditsButton:MovieClip = new MyButton(&quot;Credits&quot;);
	myCreditsButton.addEventListener(MouseEvent.CLICK, clickBtnCredits); // new line!
	addChild(myCreditsButton);
	myCreditsButton.x = 340;
	myCreditsButton.y = 89;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>is it correct to still be referring to myButton?</p>
<p>for example shouldn&#8217;t this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	<span style="color: #808080; font-style: italic;">// Instantiate a new credits button:</span>
	<span style="color: #000000; font-weight: bold;">var</span> myCreditsButton:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> MyButton<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Credits&quot;</span><span style="color: #66cc66;">&#41;</span>;
	myCreditsButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickBtnCredits<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// new line!</span>
	addChild<span style="color: #66cc66;">&#40;</span>myCreditsButton<span style="color: #66cc66;">&#41;</span>;
	myButton.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">340</span>;
	myButton.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">89</span>;</pre></div></div>

<p>actually be changed to this?:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	<span style="color: #808080; font-style: italic;">// Instantiate a new credits button:</span>
	<span style="color: #000000; font-weight: bold;">var</span> myCreditsButton:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> MyButton<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Credits&quot;</span><span style="color: #66cc66;">&#41;</span>;
	myCreditsButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickBtnCredits<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// new line!</span>
	addChild<span style="color: #66cc66;">&#40;</span>myCreditsButton<span style="color: #66cc66;">&#41;</span>;
	myCreditsButton.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">340</span>;
	myCreditsButton.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">89</span>;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4028</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Wed, 16 Sep 2009 01:34:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4028</guid>
		<description>Thanks, Mark.  No need to get fancy with import statements, unless you&#039;re referring to Classes that are in other folders.  If everything&#039;s just mashed into the same folder and exists in parallel, you can get away with just instantiating Classes as normal.

Of course, when your project gets larger, it won&#039;t do to have piles of Classes jammed together in a single folder.  That&#039;s why an upcoming Understanding Classes tutorial (probably part 5) will deal with &lt;b&gt;import&lt;/b&gt; and &lt;b&gt;package&lt;/b&gt; statements.  They confused the Hell out of me at first, but i think i&#039;m finally catching on.</description>
		<content:encoded><![CDATA[<p>Thanks, Mark.  No need to get fancy with import statements, unless you&#8217;re referring to Classes that are in other folders.  If everything&#8217;s just mashed into the same folder and exists in parallel, you can get away with just instantiating Classes as normal.</p>
<p>Of course, when your project gets larger, it won&#8217;t do to have piles of Classes jammed together in a single folder.  That&#8217;s why an upcoming Understanding Classes tutorial (probably part 5) will deal with <b>import</b> and <b>package</b> statements.  They confused the Hell out of me at first, but i think i&#8217;m finally catching on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.untoldentertainment.com/blog/2009/09/15/tutorial-understanding-classes-in-as3-part-3/comment-page-1/#comment-4027</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 16 Sep 2009 01:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=1572#comment-4027</guid>
		<description>Nice tutorial. I was having problems with the classes communicating with each other. This seems really simple. I thought there would be import statements to pull all the classes in and things like that. Thanks for putting this all down.</description>
		<content:encoded><![CDATA[<p>Nice tutorial. I was having problems with the classes communicating with each other. This seems really simple. I thought there would be import statements to pull all the classes in and things like that. Thanks for putting this all down.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

