# Class Inheritance

**URL:** <https://forum.kirupa.com/t/class-inheritance/327179>\
**Category:** flash\
**Created:** [February 11, 2012, 12:07am UTC](https://forum.kirupa.com/t/class-inheritance/327179 "2012-02-11T00:07:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeponkz](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jeponkz](https://forum.kirupa.com/u/jeponkz)\
**Post date:** [February 11, 2012, 12:07am UTC](https://forum.kirupa.com/t/class-inheritance/327179/1 "2012-02-11T00:07:42Z")

</div>

```auto
package  
{
	import fl.motion.Color;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.ColorTransform;
	import flash.events.MouseEvent;

	public class CustomBuildings extends Sprite
	{

		public function CustomBuildings() 
		{
			this.mouseChildren = false;
			this.buttonMode = true;
			this.addEventListener (MouseEvent.MOUSE_OVER , onOver);
			this.addEventListener (MouseEvent.MOUSE_OUT, onOut);
                        this.addEventListener (MouseEvent.CLICK, onClick);
		}
	
		private function onOver(e:MouseEvent)
		{
			var ct:ColorTransform = this.transform.colorTransform;
			ct.color = 0xF89807;
			transform.colorTransform = ct;
		}
		
		private function onOut(e:MouseEvent):void 
		{
			var ct:ColorTransform= this.transform.colorTransform 
			ct.color = 0x9F9F9F;
			transform.colorTransform = ct;
		}

                private function onClick(e:MouseEvent):void
                {
                    //NEED HELP HERE!!!
                }

	}

}

```

```auto

package 
{

	public class GuardHouse extends CustomBuildings
	{
		
		public function GuardHouse() 
		{
			
		}
		
	}

}

```

```auto

package 
{
	
	public class Gym extends CustomBuildings
	{
		
		public function Gym() 
		{
			
		}
		
	}

}

```

I want to determine that everytime I click the GuardHouse it will trace its a GuardHouse, and when I click the Gym it will trace its a Gym. And the code must be in the CustomBuilding Class, in the event CLICK…

Anybody could tell me the solution?? THank you so much in advance…
