<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">
<channel><title><![CDATA[ActionScript.org Flash, Flex and ActionScript Resources - Comments for article: Another Useful, Reusable AS3 Class, "ButtonDisabler"]]></title><link>http://www.actionscript.org/resources</link><description /><language>en-us</language><copyright><![CDATA[http://www.actionscript.org/resources]]></copyright><generator>N/A</generator><webMaster>general.redirect@gmail.com</webMaster><lastBuildDate>Mon, 23 Nov 2009 07:28:33 CST</lastBuildDate><ttl>20</ttl><item><title><![CDATA[Comment #1]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12479</link><description><![CDATA[Thanks for the great tutorial. I just finished it successfully, but I noticed that in your code, the line "lastClicked = currentButton;" is missing from the final clickHandler function and instead of it it has "currentButton.alpha = 0.5;" wrongly!

It is ok on the files you have attached but not on the code notes on pages :) it was easy to find and correct, but thought to let you know about it anyway so other people will see the tutorial correctly...

Thanks,
Hadi<br/><br/>
(Comment posted by Hadi Tavakoli at 8:33 am, Tue 6th Jan 2009)]]></description><author>no@spam.com (Hadi Tavakoli)</author><pubDate><![CDATA[Tue, 06 Jan 2009 08:33:16 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12479</guid></item><item><title><![CDATA[Comment #2 (Reply to Comment #1)]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12740</link><description><![CDATA[Hey Hadi,
Thanks a lot. This was very helpful. I was surprised why the clip did behave like before for Scaling. After changing it to "lastCliked=currentButton" instead of "currentButton.alpha=0.5" it worked.<br/><br/>
(Comment posted by Kadi at 9:27 pm, Sun 8th Mar 2009)]]></description><author>no@spam.com (Kadi)</author><pubDate><![CDATA[Sun, 08 Mar 2009 21:27:26 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12740</guid></item><item><title><![CDATA[Comment #3]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12512</link><description><![CDATA[nicely done.  kudos for the precision... not just for the "how to" but also the "why".<br/><br/>
(Comment posted by Bob at 12:05 pm, Thu 15th Jan 2009)]]></description><author>no@spam.com (Bob)</author><pubDate><![CDATA[Thu, 15 Jan 2009 12:05:12 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12512</guid></item><item><title><![CDATA[Comment #4]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12515</link><description><![CDATA[Great read.  I always rewrite code that disables button functionality.  This is a life saver.<br/><br/>
(Comment posted by Ryan at 3:09 pm, Fri 16th Jan 2009)]]></description><author>no@spam.com (Ryan)</author><pubDate><![CDATA[Fri, 16 Jan 2009 15:09:14 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12515</guid></item><item><title><![CDATA[Comment #5]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12525</link><description><![CDATA[Very interesting use of classes for a very common problem. I handled the "external" effect of the clicked button in a more "lazy" way= in my button class definition i define a "down" and "up" function for this button. So, whatever button i design, it will always have those functions. So, in my ButtonDisabler class, i just call the button .down and .up public methods to "enable" and "disable" them. 
I know it's not very versatile but since i'm the only one making my flash site from scratch i'll manage.
Thanks for your tut, i'll check the rest.
Cheers!<br/><br/>
(Comment posted by Eduardo at 10:08 am, Mon 19th Jan 2009)]]></description><author>no@spam.com (Eduardo)</author><pubDate><![CDATA[Mon, 19 Jan 2009 10:08:20 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12525</guid></item><item><title><![CDATA[Comment #6]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12532</link><description><![CDATA[Just finished reading your tutorial. Excellent narration and explanation. Being new in AS3 I'd like to know how to use currentButton to point to a different section of my fla, say "aboutus" instead of just changing the alpha.
Thanks<br/><br/>
(Comment posted by Jim at 11:49 am, Tue 20th Jan 2009)]]></description><author>no@spam.com (Jim)</author><pubDate><![CDATA[Tue, 20 Jan 2009 11:49:26 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12532</guid></item><item><title><![CDATA[Comment #7]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12533</link><description><![CDATA[Jim,

I indicated in the article that of course you'll want to make specific buttons do specific things (The class just defines behavior that's common to all of them). You would do that in your client code, that is, the outside code that is creating and using the class instance. In the case of my sample files, the client code is in the fla. Assuming you have those files, add this code to frame 1 after everything else:

for(var i:int = 0; i < buttonArray.length; i++) {
	//add the same event listener to all the buttons
	buttonArray[i].addEventListener(MouseEvent.CLICK, clickHandler);
}

function clickHandler(event:MouseEvent):void {
	if(event.currentTarget == b1) {
		trace("button one clicked");
	}
	if(event.currentTarget == b2) {
		trace("button two clicked");
	}
}

I just did the first two buttons for you, but programming the rest of them would be similar. Replace the trace command with whatever you want the button to really do. Also, the b1, b2, b3, b4, etc.... is just used as an example. Imagine that the instance name of the button is "aboutus" instead of "b1" and it will work equally as well.

This will mean each button has two click listeners, one inside the class and one outside the class. One defines common behavior, the other defines specific behavior. 

Hope that helps.<br/><br/>
(Comment posted by Jody Hall at 6:57 pm, Tue 20th Jan 2009)]]></description><author>no@spam.com (Jody Hall)</author><pubDate><![CDATA[Tue, 20 Jan 2009 18:57:24 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12533</guid></item><item><title><![CDATA[Comment #8]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12727</link><description><![CDATA[I guess the only reason for using removeEventListener rather than buttonEnabled=false, is that if you leave the listeners attached, the button objects will stay in memory even after they've been removed from the stage...it could be easily modified to use weak listeners though.<br/><br/>
(Comment posted by Shawn at 5:45 pm, Thu 5th Mar 2009)]]></description><author>no@spam.com (Shawn)</author><pubDate><![CDATA[Thu, 05 Mar 2009 17:45:36 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12727</guid></item><item><title><![CDATA[Comment #9]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12729</link><description><![CDATA[Thanks again.  looks great..can't wait this new button disabler class  into my project.<br/><br/>
(Comment posted by Joshua VP at 10:36 pm, Thu 5th Mar 2009)]]></description><author>no@spam.com (Joshua VP)</author><pubDate><![CDATA[Thu, 05 Mar 2009 22:36:33 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12729</guid></item><item><title><![CDATA[Comment #10]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12745</link><description><![CDATA[Great Tutorial. Expecting  more Jody....
I have become fan of u... Ur tutorials are excellent for beginners.
Kindly give us tips to become good actionscript programmers<br/><br/>
(Comment posted by rabin at 1:53 am, Thu 12th Mar 2009)]]></description><author>no@spam.com (rabin)</author><pubDate><![CDATA[Thu, 12 Mar 2009 01:53:01 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12745</guid></item><item><title><![CDATA[Comment #11]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12802</link><description><![CDATA[Thankyou so much for all your wonderful tutorials! I'm very new to actionscript and found it all very overwhelming, especially classes which I was avoiding like the plague! I'm still getting my head around it all but you have opened my eyes to the possibilities and I'm quite excited about really getting to grips with writing my own scripts complete with classes!!! So thank you again for such easy to follow steps!<br/><br/>
(Comment posted by Louisa at 2:31 am, Tue 24th Mar 2009)]]></description><author>no@spam.com (Louisa)</author><pubDate><![CDATA[Tue, 24 Mar 2009 02:31:25 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment12802</guid></item><item><title><![CDATA[Comment #12]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13134</link><description><![CDATA[Great.....Really it helps in understanding of oops concept practically.......Jody please post such examples daily which will increase oops knowledge and interest...........<br/><br/>
(Comment posted by Chandrakant at 8:47 am, Wed 17th Jun 2009)]]></description><author>no@spam.com (Chandrakant)</author><pubDate><![CDATA[Wed, 17 Jun 2009 08:47:55 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13134</guid></item><item><title><![CDATA[Comment #13]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13143</link><description><![CDATA[Great!  Applying OOP to real scenarios--especially when trying to un-learn my "frame 1 is omniscient" non-Class methodologies--has been the greatest challenge. Very helpful.<br/><br/>
(Comment posted by Greg Neumayer at 10:42 am, Fri 19th Jun 2009)]]></description><author>no@spam.com (Greg Neumayer)</author><pubDate><![CDATA[Fri, 19 Jun 2009 10:42:45 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13143</guid></item><item><title><![CDATA[Comment #14]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13209</link><description><![CDATA[I was wondering how you could change it to use more than one disablerEffect?<br/><br/>
(Comment posted by vxd at 6:33 am, Tue 7th Jul 2009)]]></description><author>no@spam.com (vxd)</author><pubDate><![CDATA[Tue, 07 Jul 2009 06:33:54 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13209</guid></item><item><title><![CDATA[Comment #15]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13288</link><description><![CDATA[Hi all, this tut is awesome, I´ve worked with AS 2 for few years and finally i´m getting involved in  AS3. The explanation about polymorphism was clear, but the interfaces implementation was not totally filled. 

Suppose in the AlphaEffect Class we forget to override the method "morph", the movie will not work as is expected, in addition no error is shown. The point is that our interface DisablerEffect must be declared as interface.  e.g.(public interface DisablerEffect {... code}) and our AlphaEffect and ScaleEffect must implement that interface e.g.(public class AlphaEffect implements  DisablerEffect{...code}). 

This way if we forget to declare any method, the error will arise, giving us a light where the problem is.<br/><br/>
(Comment posted by edgar florez at 9:46 pm, Mon 27th Jul 2009)]]></description><author>no@spam.com (edgar florez)</author><pubDate><![CDATA[Mon, 27 Jul 2009 21:46:18 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13288</guid></item><item><title><![CDATA[Comment #16]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13335</link><description><![CDATA[Your article is super after i got a feeling that why shouldn't i do it for whole page it self that too on the fly like we dont keep any buttons array just get the buttons from container and that container will only have one button disabled. Please see me code. Its just r&d and i wanted to share you

ToggleButtons(event:MouseEvent):void
{
	var arr:Array=getChildren();//This gets all children from container
	for(var i:int=0;i<arr.length;i++)
	{
		var butt:Button=arr[i] as Button;
		if(butt!=null)
		{
			if(butt.mouseEnabled==false)
			{
				butt.mouseEnabled=true;
				butt.alpha=1;
			}
		}
	}
	var button:Button=event.currentTarget as Button;
	button.alpha=0.5;
	button.mouseEnabled=false;
}<br/><br/>
(Comment posted by Satish at 8:02 am, Thu 13th Aug 2009)]]></description><author>no@spam.com (Satish)</author><pubDate><![CDATA[Thu, 13 Aug 2009 08:02:17 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13335</guid></item><item><title><![CDATA[Comment #17]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13368</link><description><![CDATA[I am new to AS3 and I am reading few books but your explaination is so simple and very good. I would rate this article excellent.<br/><br/>
(Comment posted by Andy Dohare at 5:17 pm, Fri 21st Aug 2009)]]></description><author>no@spam.com (Andy Dohare)</author><pubDate><![CDATA[Fri, 21 Aug 2009 17:17:30 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13368</guid></item><item><title><![CDATA[Comment #18]]></title><link>http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13521</link><description><![CDATA[Very good tutorial written in a clear and fun way!<br/><br/>
(Comment posted by Benny at 5:26 pm, Thu 1st Oct 2009)]]></description><author>no@spam.com (Benny)</author><pubDate><![CDATA[Thu, 01 Oct 2009 17:26:17 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/856/1/Another-Useful-Reusable-AS3-Class-ButtonDisabler/Page1.html#Comment13521</guid></item></channel></rss>