# Reset Help! Please!

**URL:** <https://forum.kirupa.com/t/reset-help-please/321260>\
**Category:** Uncategorized\
**Created:** [April 14, 2011, 2:07pm UTC](https://forum.kirupa.com/t/reset-help-please/321260 "2011-04-14T14:07:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beatsdawill](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@beatsdawill](https://forum.kirupa.com/u/beatsdawill)\
**Post date:** [April 14, 2011, 2:07pm UTC](https://forum.kirupa.com/t/reset-help-please/321260/1 "2011-04-14T14:07:48Z")

</div>

**[COLOR=“Sienna”]Ok here are the things that are giving me problems. Whenever the player dies/wins a screen pops up with a button that takes you back to the menu where you can click play to play again… the thing is that every time you do this I get a bunch of null object errors! And these are the things that give me the problem: How do I silence them all together when you go back to the previous scene (once you win or you die…) :([/COLOR]**

apple\_mc.addEventListener(Event.ENTER\_FRAME, circleHit1,false,0,true);

function circleHit1(event:Event): void {  
if(apple\_mc.hitTestObject(player\_mc))  
{

```
	health.x=(health.x -10)
	
	
} 

```

}

apple2\_mc.addEventListener(Event.ENTER\_FRAME, circleHit2,false,0,true);

function circleHit2(event:Event): void {  
if(apple2\_mc.hitTestObject(player\_mc))  
{

```
	health.x=(health.x -10)
	
} 

```

}

player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit3,false,0,true);

function circleHit3(event:Event): void {  
if(player\_mc.hitTestObject(apple88))  
{

```
	health.x=(health.x -10)
	
} 

```

}

player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit4,false,0,true);

function circleHit4(event:Event): void {  
if(player\_mc.hitTestObject(Object(this).platform\_mc.fire))  
{

```
	health.x=(health.x -5)
	
} 

```

}

health.addEventListener(Event.ENTER\_FRAME, circleHit5,false,0,true);

function circleHit5(event:Event): void {  
if(health.hitTestObject(die))

{

```
    lost.x=346.05
	lost.y=269.75
	SoundMixer.stopAll();
	health.removeEventListener(Event.ENTER_FRAME,circleHit5);
	
	
		
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit6,false,0,true);

function circleHit6(event:Event): void {  
if(player\_mc.hitTestObject(mel\_mc))  
{

```
	Object(root).mel_mc.gotoAndStop(2);
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit6);
		
} 

```

}

player\_mc.addEventListener(Event.ENTER\_FRAME,circleHit7 ,false,0,true);

function circleHit7(event:Event): void {  
if(player\_mc.hitTestObject(jelly1))  
{

```
	health.x=575.3
	jelly1.y=1300
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit7);
} 

```

}

player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit8,false,0,true);

function circleHit8(event:Event): void {  
if(player\_mc.hitTestObject(appleba))  
{

```
	health.x=575.3
	appleba.y=1300
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit8);
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit9,false,0,true);

function circleHit9(event:Event): void {  
if(player\_mc.hitTestObject(boy))  
{

```
	Object(this).boy.gotoAndStop(2);
	
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit9);
}

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit10,false,0,true);

function circleHit10(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).platform\_mc.robot1))  
{

```
	health.x=(health.x -5)
	
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit11,false,0,true);

function circleHit11(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).platform\_mc.robot2))  
{

```
	health.x=(health.x -5)
	
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit12,false,0,true);

function circleHit12(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).platform\_mc.robot3))  
{

```
	health.x=(health.x -5)
	
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit13,false,0,true);

function circleHit13(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).platform\_mc.robot4))  
{

```
	health.x=(health.x -5)
	
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit14,false,0,true);

function circleHit14(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).key))  
{  
opencage=true;  
key.y=1300;  
Object(root).platform\_mc.moneybar.gotoAndStop(2);  
player\_mc.removeEventListener(Event.ENTER\_FRAME,circleHit14);  
}

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit15,false,0,true);

function circleHit15(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).platform\_mc.jack))  
{

```
if(opencage)
{
	;
	won.x=346.05
	won.y=269.75
	Object(root).platform_mc.jack.gotoAndStop(2);
	Object(root).sound.gotoAndStop(3);
	SoundMixer.stopAll();
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit15)
}

```

}  
}

Object(root).ddhealth.dragonh.addEventListener(Event.ENTER\_FRAME, circleHit16,false,0,true);

function circleHit16(event:Event): void {  
if(Object(root).ddhealth.dragonh.hitTestObject(Object(root).ddhealth.dragond))  
{

```
	Object(root).platform_mc.dragon.y=1300;
	Object(root).platform_mc.fire.y=1300;
	Object(this).ddhealth.y=1300;
	
	ddhealth.dragonh.removeEventListener(Event.ENTER_FRAME,circleHit16);
} 

```

}  
player\_mc.addEventListener(Event.ENTER\_FRAME, circleHit17,false,0,true );

function circleHit17(event:Event): void {  
if(player\_mc.hitTestObject(Object(root).deathfall))

{

```
    lost.x=346.05
	lost.y=269.75
	SoundMixer.stopAll();
	player_mc.removeEventListener(Event.ENTER_FRAME,circleHit17);
} 

```

}

[COLOR=“Sienna”] **This is also giving me problems it is an external AS file for my Coins:** [/COLOR]

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

```
public class coin extends MovieClip 

{
	var player_mc:MovieClip;
	public static var coinsCollected:uint = 0;
	var score:MovieClip;
	
	public function coin() 
	{
		// constructor code
		this.addEventListener(Event.ENTER_FRAME,update);
	}
	
	function update (event:Event):void
	{
		player_mc=MovieClip(root).player_mc;
		if(this.hitTestObject(player_mc))
	{
		coinsCollected += 1;
		
		this.removeEventListener(Event.ENTER_FRAME,update);
		MovieClip(parent).score.text = String(coinsCollected);
		parent.removeChild(this);
		
	}
}

```

}

}  
:hangover:
