# Help! gotoAndStop Code Doesn't Work After I Convert a Button to Movie Clip!

**URL:** <https://forum.kirupa.com/t/help-gotoandstop-code-doesnt-work-after-i-convert-a-button-to-movie-clip/136238>\
**Category:** Uncategorized\
**Created:** [February 3, 2005, 6:57am UTC](https://forum.kirupa.com/t/help-gotoandstop-code-doesnt-work-after-i-convert-a-button-to-movie-clip/136238 "2005-02-03T06:57:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KIRBYSIM](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@KIRBYSIM](https://forum.kirupa.com/u/KIRBYSIM)\
**Post date:** [February 3, 2005, 6:57am UTC](https://forum.kirupa.com/t/help-gotoandstop-code-doesnt-work-after-i-convert-a-button-to-movie-clip/136238/1 "2005-02-03T06:57:54Z")

</div>

First of all, I would like to apologise for not knowing whether this code belongs to F5 or FMX Action Script. I’m that noobish, yup.

Anyway, what happened in my flash document was, I created a button, “next\_btn” with the following commands:

on(release){  
//to remove all the splats  
for (score=0;score\<100;score++){  
\_root[“splat”+score].removeMovieClip();  
}  
\_root.finger\_mc.removeMovieClip();  
gotoAndStop(“s1a2”,“gamereadys1a2”); //go to next level  
\_root.s1a1bgm.stop();  
}

I also attached a visibility code in a separate, ‘Actions’ movie clip:

onClipEvent(load){  
\_root.next\_btn.\_visible=false;  
}

onClipEvent(enterFrame){  
if (\_root.score\>=100){  
recoverytime++;  
if (recoverytime\>120){  
\_root.next\_btn.\_visible=true;  
\_root.next\_btn.swapDepths(1998);  
}  
}  
}

At this point, almost everything worked perfectly. Everything, but one thing. Apparently, the swapDepths command wasn’t working. It was then that I thought maybe swapDepths only works on movie clips.

And so I converted the button into a movie clip. I modified the instance names, etc, and almost everything worked. Everything, including swapDepths, but one thing: the gotoAndStop command.

For some reason, when I tested the movie clip (containing a button) out, it removed the splat+score and finger\_mc movie clips, as well as stoped the background music from playing. However, it did not go to the next scene and frame as specified by the gotoAndStop command. “s1a2” is the next scene, and “gameplays1a2” is its frame.

Can someone please tell me what went wrong?? All help appreciated.
