<?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: AS3 Classes Using Inheritance]]></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>Sun, 22 Nov 2009 03:47:32 CST</lastBuildDate><ttl>20</ttl><item><title><![CDATA[Comment #1]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment8801</link><description><![CDATA[I have tried this with the kaymover class, but keep getting this error: 1120 Access of undefined propert keyCode.

Here is the code:

[code]
package com.mysite.keyboard {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	
	public class KeyInheriter extends MovieClip {
		private var uKey:Boolean;
		private var dKey:Boolean;
		private var lKey:Boolean;
		private var rKey:Boolean;
		private var speedSetter:uint = 5;
		
		public function KeyInheriter() {
			stage.addEventListener(Event.ENTER_FRAME, run);
			stage.addEventListener(KeyboardEvent.KEY_DOWN, pressed);
			stage.addEventListener(KeyboardEvent.KEY_UP, unPressed);
		}
		
			private function pressed(event:KeyboardEvent) {
				if(keyCode == Keyboard.UP) {
					uKey = true;
				}
				if(keyCode == Keyboard.DOWN) {
					dKey = true;
				}
				if(keyCode == Keyboard.LEFT) {
					lKey = true;
				}
				if(keyCode == Keyboard.RIGHT) {
					rKey = true;
				}
			}
		
			private function unPressed(event:KeyboardEvent) {
				if(keyCode == Keyboard.UP) {
					uKey = false;
				}
				if(keyCode == Keyboard.DOWN) {
					dKey = false;
				}
				if(keyCode == Keyboard.LEFT) {
					lKey = false;
				}
				if(keyCode == Keyboard.RIGHT) {
					rKey = false;
				}
			}
			
			private function run(event:Event) {
				if(uKey) {
					this.y -= speedSetter;
				}
				if(dKey) {
					this.y -= speedSetter;
				}
				if(lKey) {
					this.y -= speedSetter;
				}
				if(rKey) {
					this.y -= speedSetter;
				}
			}
	}
}
[/code]

Any ideas?<br/><br/>
(Comment posted by Jeremy at 3:59 pm, Fri 11th Jan 2008)]]></description><author>no@spam.com (Jeremy)</author><pubDate><![CDATA[Fri, 11 Jan 2008 15:59:04 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment8801</guid></item><item><title><![CDATA[Comment #2]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment8803</link><description><![CDATA[Great tutorial!  I tried to apply this to the KeyMover class, but I keep getting the null error (even though it works).  I tried adding the ADDED_TO_STAGE command, but to no avail.  Here's the code I worked up:

[code]
package com.mysite.keyboard {
                import flash.display.MovieClip;
                import flash.events.Event;
                import flash.events.KeyboardEvent;
                import flash.ui.Keyboard;
                
                public class KeyInheriter extends MovieClip {
                                private var uKey:Boolean;
                                private var dKey:Boolean;
                                private var lKey:Boolean;
                                private var rKey:Boolean;
                                private var speedSetter:uint = 5;
                                
                                public function KeyInheriter() {
                                                stage.addEventListener(KeyboardEvent.KEY_DOWN, pressed);
                                                stage.addEventListener(KeyboardEvent.KEY_UP, unPressed);
                                                stage.addEventListener(Event.ENTER_FRAME, run);
                                }
                                
                                                private function pressed(event:KeyboardEvent) {
                                                                if(event.keyCode == Keyboard.UP) {
                                                                                uKey = true;
                                                                }
                                                                if(event.keyCode == Keyboard.DOWN) {
                                                                                dKey = true;
                                                                }
                                                                if(event.keyCode == Keyboard.LEFT) {
                                                                                lKey = true;
                                                                }
                                                                if(event.keyCode == Keyboard.RIGHT) {
                                                                                rKey = true;
                                                                }
                                                }
                                
                                                private function unPressed(event:KeyboardEvent) {
                                                                if(event.keyCode == Keyboard.UP) {
                                                                                uKey = false;
                                                                }
                                                                if(event.keyCode == Keyboard.DOWN) {
                                                                                dKey = false;
                                                                }
                                                                if(event.keyCode == Keyboard.LEFT) {
                                                                                lKey = false;
                                                                }
                                                                if(event.keyCode == Keyboard.RIGHT) {
                                                                                rKey = false;
                                                                }
                                                }
                                                
                                                private function run(event:Event) {
                                                                if(uKey) {
                                                                                this.y -= speedSetter;
                                                                }
                                                                if(dKey) {
                                                                                this.y += speedSetter;
                                                                }
                                                                if(lKey) {
                                                                                this.x -= speedSetter;
                                                                }
                                                                if(rKey) {
                                                                                this.x += speedSetter;
                                                                }
                                                }
                }
}

[/code]

Any ideas?<br/><br/>
(Comment posted by Jeremy at 6:59 pm, Fri 11th Jan 2008)]]></description><author>no@spam.com (Jeremy)</author><pubDate><![CDATA[Fri, 11 Jan 2008 18:59:20 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment8803</guid></item><item><title><![CDATA[Comment #3]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment9061</link><description><![CDATA[Jody,
Excellent tutorial (impressive that you are new to ActionScript...I wish I picked it up that quickly!).

Here's my question:
At the end of your tutorial you state that you can't think of a reason why you would manually want to create the Circle and Square classes. Well I have a need (I think) and it is driving me crazy trying to figure it out. 

What if there is something unique about the Circle that the Square doesn't have? So I think you would need to define a Circle class and define those items there instead of using the generated Flash Circle class. Well I thought this would be simple. Just put Circle as the Class and use the ClipDragger as the Base Class (ClipDragger would still have to extend the MovieClip class). I can not get it to work at all.

This is the error I get if I try to create my own Circle class:
5000: The class 'Circle' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.<br/><br/>
(Comment posted by Scott at 7:32 pm, Wed 23rd Jan 2008)]]></description><author>no@spam.com (Scott)</author><pubDate><![CDATA[Wed, 23 Jan 2008 19:32:19 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment9061</guid></item><item><title><![CDATA[Comment #4]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment11941</link><description><![CDATA[I used something similar but have a problem.
Exactly as you did, 2 Sprite that have a different Class name, but the same Base Class for exemple a PuzzlePiece. All pieces does the same thing, so they have the same Base Class. My problem is :

if in each puzzle part I have a Sprite for the hitzone. The shape is different for each. So I create one in each Puzzle part. To be used in the Base Class I gave them the same stage instance name like hitzone_inst. Then if you compile it there is an error.

Any idea<br/><br/>
(Comment posted by JF Fortier at 9:29 am, Wed 10th Sep 2008)]]></description><author>no@spam.com (JF Fortier)</author><pubDate><![CDATA[Wed, 10 Sep 2008 09:29:01 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment11941</guid></item><item><title><![CDATA[Comment #5]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment12118</link><description><![CDATA[The article was very clear and very helpful! Thank you!
I just have one question. I want to create an instance when I click on a button, the instance sits on top of the button. I can code the creation of the instance on the mouse down of the button but then I have to press the mouse again before I can move the instance. Is there a way to do it by somehow transfering the mouse press to the instance I created?<br/><br/>
(Comment posted by chip at 3:02 pm, Wed 15th Oct 2008)]]></description><author>no@spam.com (chip)</author><pubDate><![CDATA[Wed, 15 Oct 2008 15:02:09 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment12118</guid></item><item><title><![CDATA[Comment #6]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment12488</link><description><![CDATA[Hey Jody, you may not notice but I am learning AS3 with your tutorials! :) I will remember your name. Thanks.<br/><br/>
(Comment posted by Hadi Tavakoli at 10:57 am, Wed 7th Jan 2009)]]></description><author>no@spam.com (Hadi Tavakoli)</author><pubDate><![CDATA[Wed, 07 Jan 2009 10:57:40 CST]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment12488</guid></item><item><title><![CDATA[Comment #7]]></title><link>http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment13022</link><description><![CDATA[Jody - great tutorials.  Best introduction to AS3 class files as far as I'm concerned.  You have shown me that classes are not nearly as daunting as I thought they were.  All your tutorials are very clear and informative.  Thanks a bunch.  Keep it up!<br/><br/>
(Comment posted by Dan at 8:11 pm, Wed 20th May 2009)]]></description><author>no@spam.com (Dan)</author><pubDate><![CDATA[Wed, 20 May 2009 20:11:28 CDT]]></pubDate><guid isPermaLink="true">http://www.actionscript.org/resources/articles/716/1/AS3-Classes-Using-Inheritance/Page1.html#Comment13022</guid></item></channel></rss>