Help on codes

Currently i have this error when i click on the inedible object either cookie or sandwich then it shows an error: “TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Panel/clickon()”

its like telling me that the function has nth inside.

its this line > hpbar.Healthbar();
when i hit ctrl+shift+enter

can someone help?

Panel Code:


package
{
	import flash.display.MovieClip;
 import flash.events.*;
	import flash.text.*;
	import flash.utils.Timer;

	
	public class Panel extends MovieClip
	{
		
		private var clickScore:Number = 0;
		private var count:uint;
		private var prevCount:uint;
		private var timer:Timer;
		private var hpbar:MovieClip; 
		
		 
		public function Panel ()
		{
					setting();
		}
						
		public function setting()
		{
				
			var hpbar:Healthbar=new Healthbar();
			hpbar.x = 820;
			hpbar.y = 370;
			stage.addChild(hpbar);
			
			
			
			
			var edible:Edible = new Edible();
			edible.x = Math.random() * stage.stageWidth;
			edible.y = Math.random() * stage.stageHeight;
			stage.addChild(edible);
			count ++;
							
			var inedible:Inedible = new Inedible();
			inedible.x = Math.random() * stage.stageWidth;
			inedible.x = Math.random() * stage.stageHeight;
			stage.addChild(inedible);
			count ++;
				
			stage.addEventListener(MouseEvent.CLICK, clickon);
				
			
			timer = new Timer(8000);
			timer.addEventListener(TimerEvent.TIMER, addOn);
			timer.start();
			var score:int = 0;
			txtScore.text =clickScore.toString();
			
				
			var countTime:Number = 3;
			var myTimer:Timer = new Timer(1000,countTime);
			myTimer.addEventListener(TimerEvent.TIMER, countdown);
			myTimer.start();
							
			function countdown(event:TimerEvent):void 
			{
				
			txtTimer.text = String((countTime) - myTimer.currentCount + "s");
			}
			
			if(txtTimer.text == "0")
			{
				//trace("123"+countTime);
			myTimer.stop();
			txtTimer.text = String((countTime) - myTimer.currentCount + "s");
			gotoAndPlay(2);
			}
			
			else
			{

				gotoAndPlay(3);
			}
			
			
}
				
			private function clickon (e:MouseEvent)
	{	
	   if(e.target is Edible)
		{
			e.target.die();
			clickScore += 10;
			txtScore.text =  String(clickScore);
			
		}
		trace("123123");
				if(e.target is Inedible)
		{trace("567567")
			e.target.die();
			clickScore -= 20;
			txtScore.text = String(clickScore);
			
			
			hpbar.minusHealth();
			
		
			
	 }
		
		}
		
	 private function addOn(e:TimerEvent)
	 { 			
		prevCount = count;
		count += count;
			
	//	var len:int = deptControlArray.length; 
//for(var count:int=0;count<len;count++) 


			 for (var i:int = prevCount; i < count; i++)
			{
				var edible:Edible = new Edible();
				edible.name = "edible" + i;
				edible.x = Math.random() * stage.width;
				edible.y = Math.random() * stage.height;
				addChild(edible);
				
				
					
				var inedible:Inedible = new Inedible();
				inedible.name = "inedible" + i;
				inedible.x = Math.random() * stage.width;
				inedible.y = Math.random() * stage.height;
				addChild(inedible);
				
				

	}
		
			}
			
			
			private function spawnUp()
		{
			if (numChildren > 10)
			{
				timer.stop();
				
				var i:uint = numChildren;
				while(i++)
				
				 
				while( numChildren > 10 ) 
				{ 
				
				removeChildAt(1);
				
				
				gotoAndPlay(3);
				}
				}
	}
	}
}

Edible Code:


package 
{
	import flash.display.MovieClip;
	import flash.events.*;
	

	public dynamic class Edible extends MovieClip
	{
		
		 var xSpeed:Number = Math.random() * 4;
		 var ySpeed:Number = Math.random() * 4;
		
		public function Edible()
		{
		 this.addEventListener(Event.ENTER_FRAME, wobbally);
			this.gotoAndStop(Math.ceil(Math.random()*4));
			
		}
		
		public function wobbally (e:Event)
		{
			
			if (this.x < 0 || this.x > 400)
			{
				this.xSpeed *= -1;
			}
			
			if (this.y < 0 || this.y > 400)
			{
				this.ySpeed *= -1;
			}
			
			this.x += this.xSpeed;
			this.y += this.ySpeed;
		}
		
		public function die()
		{
			this.removeEventListener(Event.ENTER_FRAME, wobbally);
			parent.removeChild(this);
		}	
		
	}
	
}

Inedible Code:


package 
{
	import flash.display.MovieClip;
	import flash.events.*;
	

	public dynamic class Inedible extends MovieClip
	{
		
		 var xSpeed:Number = Math.random() * 4;
		 var ySpeed:Number = Math.random() * 10;
		
		public function Inedible()
		{
			this.addEventListener(Event.ENTER_FRAME, wobbally);
			this.gotoAndStop(Math.ceil(Math.random()*4));
			
		}
		
		public function wobbally (e:Event)
		{
			if (this.x < 0 || this.x > 400)
			{
				this.xSpeed *= -1;
			}
			
			if (this.y < 0 || this.y > 400)
			{
				this.ySpeed *= -1;
			}
			
			this.x += this.xSpeed;
			this.y += this.ySpeed;
			
		}
		
		public function die()
		{
			this.removeEventListener(Event.ENTER_FRAME, wobbally);
			parent.removeChild(this);
		}	
		
	}
	
}

Healthbar Code:


package 
{
	import flash.display.MovieClip;
	import flash.events.*;


public class Healthbar extends MovieClip
{
	
	public static const health1:String = "minusone";
	public static const health2:String = "minustwo";
	public static const health3:String = "minusthree";
	public static const health4:String = "minusfour";
	public static const health5:String = "minusfive";
	public static const health6:String = "minussix";
	public static const health7:String = "minusseven";
	public static const health8:String = "minuseight";
	public static const health9:String = "minusnine";
	public static const health10:String = "minusten";
			
			
			public function minusHealth()
			{
			if(this.currentLabel == Healthbar.health1)
						{
							this.gotoAndPlay("minusone");
							return;
						}
							
						if(this.currentLabel == Healthbar.health2)
						{
							this.gotoAndPlay("minustwo");
							return;
						}

						if(this.currentLabel == Healthbar.health3) 
						{
							this.gotoAndPlay("minusthree");
							return;
						}

						if(this.currentLabel == Healthbar.health4) 
						{
							this.gotoAndPlay("minusfour");
							return;
						}
						
						if(this.currentLabel == Healthbar.health5) 
						{
							this.gotoAndPlay("minusfive");
							return;
						}
						
						if(this.currentLabel == Healthbar.health6) 
						{
							this.gotoAndPlay("minussix");
							return;
						}
						
						if(this.currentLabel == Healthbar.health7) 
						{
							this.gotoAndPlay("minusseven");
							return;
						}
						
						if(this.currentLabel == Healthbar.health8) 
						{
							this.gotoAndPlay("minuseight");
							return;
						}
						
						if(this.currentLabel == Healthbar.health9) 
						{
							this.gotoAndPlay("minusnine");
							return;
						}trace("race");
						
						
						if(this.currentLabel == Healthbar.health10) 
						{
							this.gotoAndPlay("minusten");
							return;
						}
			
			//e.target is Inedible) && (health2 is "minustwo"
	/*	public function Healthbar()
		{
			
			
			//var healthbar:Healthbar = new Healthbar();
			//this.gotoAndPlay("minusone");
				
				//stage.addChild(healthbar);
				
					//	stage.addChild(Healthbar.health1);
			
		*/
		
}
}
		
			}