# Button code to change scenes

**URL:** https://forum.kirupa.com/t/button-code-to-change-scenes/120306
**Category:** Uncategorized
**Created:** [August 23, 2004, 6:33am UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306 "2004-08-23T06:33:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fio](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@fio](https://forum.kirupa.com/u/fio)
#### Post date: [August 23, 2004, 6:33am UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306/1 "2004-08-23T06:33:22Z")

</div>

Ok so I am stcuk on a basic… trying to move from scene to scene through buttons. In my code I have:

on (release) {  
gotoAndPlay(“home”, 1);  
}

and four other buttons relatng to the scene (or web page as it is a website). I have given the button an instance name on its scene as well.  
Do I put this code on each button on each scene?  
And how do I get the buttons to work - there must be somewhere that I need to put more code in?  
PLease, please…I know its basic, but so hard to get past and I’m soooo tired… searching searching…  
Fio

---

<div class="post-metadata">

### Author: ![lampe](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lampe](https://forum.kirupa.com/u/lampe)
#### Post date: [August 23, 2004, 8:05am UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306/2 "2004-08-23T08:05:49Z")

</div>

So you want a homepage (scene is called “home”) and four pages (called “one”, “two”, “three”, and “four”).  
Create five buttons. Put four buttons on scene 1 (“homepage”).On the first one, give this actionscript:

on (release) {  
gotoAndPlay(“one”, 1);  
}

on button two:

on (release) {  
gotoAndPlay(“two”, 1);  
}

and so on for button three and four.

On the stage of scene “one”, place the button that was left over. Give this actionscript:

on (release) {  
gotoAndPlay(“home”, 1);  
}

Put this button (with this script) on the stages of scene “one”, “two”, “three”, and “four”.

Everything should work now.

I hope this helps.

Nookyalur  
[www.nookyalur.com](http://www.nookyalur.com)

---

<div class="post-metadata">

### Author: ![fio](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@fio](https://forum.kirupa.com/u/fio)
#### Post date: [August 23, 2004, 11:57am UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306/3 "2004-08-23T11:57:54Z")

</div>

Thanks Nookyalur,  
I have just tried what you suggested, and now I am wondering if the reason that it isn’t working is because I have my buttons on the homepage on different layers?  
Hope your website ambitions and music go well!  
Fio

---

<div class="post-metadata">

### Author: ![lampe](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lampe](https://forum.kirupa.com/u/lampe)
#### Post date: [August 23, 2004, 12:02pm UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306/4 "2004-08-23T12:02:44Z")

</div>

If you zip your fla-files an upload it somewhere, maybe i can take a look at it…

nookyalur

---

<div class="post-metadata">

### Author: ![fio](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@fio](https://forum.kirupa.com/u/fio)
#### Post date: [August 23, 2004, 12:33pm UTC](https://forum.kirupa.com/t/button-code-to-change-scenes/120306/5 "2004-08-23T12:33:34Z")

</div>

Oh I finally cracked it! Was so obvious - hadn’t named the scenes according to the buttons - silly me! Thanks Nookyalur - you put me on the right path.  
Fio  
[www.lindenlangdon.com](http://www.lindenlangdon.com)
