# Goto Frame gives Null Reference

**URL:** <https://forum.kirupa.com/t/goto-frame-gives-null-reference/289193>\
**Category:** flash\
**Created:** [May 27, 2009, 12:06pm UTC](https://forum.kirupa.com/t/goto-frame-gives-null-reference/289193 "2009-05-27T12:06:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![udi001](https://avatars.discourse-cdn.com/v4/letter/u/bc8723/32.png) [@udi001](https://forum.kirupa.com/u/udi001)\
**Post date:** [May 27, 2009, 12:06pm UTC](https://forum.kirupa.com/t/goto-frame-gives-null-reference/289193/1 "2009-05-27T12:06:40Z")

</div>

Hello everyone,

I’m trying to link 2 frames to each other by buttons

when i press on bt1 - it takes me to frame no’2. that OK. (bt1 exists only on frame 1)  
when i press on bt2 - it takes me to frame no’1 that Ok, but gives me a NULL REFERENCE ERROR. and i can’t press on bt 1 again.

\*\* bt1 is my button that don’t work (and exist only on frame 1)  
\*\* bt2 is the other button that work and exist in both frames

Both are inside some movieclips as you can see.

Here’s Frame 1 code:

> 

stop();  
import flash.events.MouseEvent;  
this.centralPartofHP\_insNm.amiteiFixMenu\_insNm.[COLOR=red]bt1[/COLOR].addEventListener(MouseEvent.MOUSE\_DOWN,gotoFrame2 );

function gotoFrame2(event:MouseEvent):void{  
gotoAndStop(2);  
}

and Frame 2 code

> 

stop();  
import flash.events.MouseEvent;  
this.topMenu\_insNm.[COLOR=red]bt2[/COLOR].addEventListener(MouseEvent.MOUSE\_DOWN,gotoFrame1 );

function gotoFrame1(event:MouseEvent):void{  
gotoAndStop(1);  
}
