# Problem with gotoandplay function

**URL:** https://forum.kirupa.com/t/problem-with-gotoandplay-function/312930
**Category:** flash
**Created:** [August 16, 2010, 7:06am UTC](https://forum.kirupa.com/t/problem-with-gotoandplay-function/312930 "2010-08-16T07:06:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vinod1982](https://avatars.discourse-cdn.com/v4/letter/v/eada6e/32.png) [@vinod1982](https://forum.kirupa.com/u/vinod1982)
#### Post date: [August 16, 2010, 7:06am UTC](https://forum.kirupa.com/t/problem-with-gotoandplay-function/312930/1 "2010-08-16T07:06:26Z")

</div>

Hi all,

I am using the below function in one of my application, but its not working. It says 1120: Access of undefined property btnTwo.

For button I have given the instance name as btnTwo

btnTwo.addEventListener(MouseEvent.CLICK, btn2);  
function btn2(event:MouseEvent):void {  
gotoAndPlay(24);  
}

Please help me how will I correct it.

Thanks in advance
