# Var gotoAnd play scene

**URL:** <https://forum.kirupa.com/t/var-gotoand-play-scene/44290>\
**Category:** flash\
**Created:** [March 2, 2004, 4:41pm UTC](https://forum.kirupa.com/t/var-gotoand-play-scene/44290 "2004-03-02T16:41:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![guru212](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@guru212](https://forum.kirupa.com/u/guru212)\
**Post date:** [March 2, 2004, 4:41pm UTC](https://forum.kirupa.com/t/var-gotoand-play-scene/44290/1 "2004-03-02T16:41:53Z")

</div>

I’m hoping you guys can help me.

I am working on a nav where when the user clicks on a selection, the nav first plays through a transition/outtro and then is directed to the appropriate scene via a variable embedded into the nav button.

For whatever reason it seems to simply cycle through all the different scenes when I click on a the buttons rather than go to the appropriate scene.

This is what I have:

* * *

In the button:

on (release) {  
\_root.play();  
y = “1”;  
getURL(“body\_home.htm”, “body”);  
}

* * *

In the last frame of the scene:

stop();  
if (y = “1”) {  
\_root.gotoAndPlay(1);  
}  
if (y = “2”) {  
\_root.gotoAndPlay(2);  
}  
if (y = “3”) {  
\_root.gotoAndPlay(“portfolio”);  
}  
if (y == “4”) {  
\_root.gotoAndPlay(“clients”);  
}  
if (y == “5”) {  
\_root.gotoAndPlay(“ftp”);  
}  
if (y == “6”) {  
\_root.gotoAndPlay(“contact”);  
}
