# Q on buttons and frames and scenes

**URL:** <https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476>\
**Category:** flash\
**Created:** [February 13, 2003, 7:02pm UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476 "2003-02-13T19:02:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pares101](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pares101](https://forum.kirupa.com/u/pares101)\
**Post date:** [February 13, 2003, 7:02pm UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/1 "2003-02-13T19:02:35Z")

</div>

Ok lets say i have 4 buttons

1 2 3 4

they are all laid out normally now i play my moviewhich displays 1 2 3 4

i want it that when i click on one of them that they play the de-load movie which is on frame 355 of the main movie

```php
on (release) {
	gotoAndPlay(355);
}

```

what is the code that i put to tell which button was pressed so i can load Scene 1 2 3 or 4?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 12:10am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/2 "2003-02-14T00:10:56Z")

</div>

If I’m understanding you correctly, you’re trying to link to different scenes, if that’s correct then just apply something like this:

```php
on (release) {
    gotoAndPlay("scene2");
}

```

That would link it to scene 2 obviously. =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 12:40am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/3 "2003-02-14T00:40:55Z")

</div>

yes… i want to do that but before i go to the next scene i want to play frame up till 355 than go to the next scene

because from frame 355 - 455 i have an animation of stuff dissapearing so how would i do that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 12:54am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/4 "2003-02-14T00:54:33Z")

</div>

If you want it to go to the next scene when it reaches frame 355, then place this action on that frame:

```php
gotoAndPlay("scene2");

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 1:10am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/5 "2003-02-14T01:10:09Z")

</div>

ok… now lets say i have 5 buttons and if i click on one than it goes and play 355 how do i tell each button to goto another scene after its done playing the end of the frame 455

scene1 scene2 scene3 scene4 scene5

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 1:21am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/6 "2003-02-14T01:21:54Z")

</div>

apply the first code i posted on the button that is on frame 455

```php
on (release) {
    gotoAndPlay("scene2");
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 1:35am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/7 "2003-02-14T01:35:25Z")

</div>

another way to do this is through the use of variables. in which you can have the animation of that closing movie in a movie clip on the last frame, and then have a variable determain which button has been clicked.

on the buttons you should tell flash to go to that frame where the movie is. your case frame 355, and also set the variable ‘content’ to a number

```auto

//for button 1 (put this on button 1)

on (press) {
    _root.closingmovie.content = 1;
    gotoAndPlay(355);
  }
//for button 2 (put this on button 2)

on (press) {
    _root.closingmovie.content = 2;
    gotoAndPlay(355);

```

then in the mc in which the closing animation is in (in the above code i gave this mc the instance name “closingmovie” remember to give this movie that instance name.)

put this code in a frame after your animation

```auto

if (content == 1) {
    gotoAndPlay("scene2");

if (content == 2) {
    gotoAndPlay("scene3");

```

and so on

this is not tested, off the top of my head, so give it a go, iam going to check it out when i get home, hope it helps.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 2:50am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/8 "2003-02-14T02:50:29Z")

</div>

i have no idea why, but its not working for me??

:-\ :-\

here is what i had and was trying to do, i think its something to do with the scene issue in mx, though i thought i fixed that problem. have a look anyway. ill keep at it.:crazy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 3:00am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/9 "2003-02-14T03:00:11Z")

</div>

ok fixed now, before i was using

```auto

if (_root.content == 1) {
    _root.gotoAndPlay("Scene 2", "section2");
}

```

when to make scenes work in flash mx i used, which works now

```auto

if (_root.content == 1) {
    _root.gotoAndPlay("section2");
}

```

all works now, hope this is what u wanted. 🙂

😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 3:04am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/10 "2003-02-14T03:04:45Z")

</div>

ok it is , but i think you guys mixed up … its not a movie really its just the main frame going from 355 - to 555 or something its not a movie clip! Its just animation of stuff de-loading on the main timeline so how then would i do it ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 3:07am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/11 "2003-02-14T03:07:54Z")

</div>

you could just cut and paste those frames into the movie clip or you can change some , give me a sec

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 3:31am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/12 "2003-02-14T03:31:11Z")

</div>

ok here is the file using the code on the maintimeline ,

ok, now what i changed was the following::

got rid of the \_root. tags on the if statments

changed the buttons to go to frame label on the main timeline

copy and pasted the animation of the rectangle on the main timeline. as well as the code (if statements)

::: added some buttons on scene 2-4 to get back to the main scene.

here is the file  
Hope this can help you 😏

:::::Can i just add and this is no means to tell you off.

i hope you understand whats happening in the fla , because this is for you to learn not just to get the flas and make a website. if you dont understand what i have done, please tell me , and i will explain it… i dont mind helping, i enjoy helping others. just hope your learning from all this.

😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 3:36am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/13 "2003-02-14T03:36:05Z")

</div>

Oh no way , you are actually helping me im learning little by little i always get confsued with using variables and stuff. But i try to do a lot of looking around on tutorials and how to do stuff… I actually look at your .fla you send and try to compare on what im trying to do , just the .root stuff gets way out of hand for me and i get lost.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 4:06am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/14 "2003-02-14T04:06:41Z")

</div>

ok kool, explain what the problem with the root stuff?

by the way download this fla instead , i forgot to add some graphic, call me picky 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 4:37am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/15 "2003-02-14T04:37:37Z")

</div>

on the new .fla you sent me the closingmc isnt being used right?

and why do you have

```php
gotoAndPlay(15);

```

at the end?? dont you already do that when u click on the button?

```php
if (content == 1) {
	_root.gotoAndPlay("section2");

```

this means that its going to search for section 2? in the root folder?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 4:50am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/16 "2003-02-14T04:50:25Z")

</div>

theres no closing mc?

the code go to frame 15 is so that the if statement can loop, so if the if statement in frame 14 is false it would just play, so i put that code in 15 so it can go back until the if statement is true.

if (content == 1) {  
\_root.gotoAndPlay(“section2”);

this is asking flash if the content = 1, i make the content = 1 in the button, but this is asking it. (if statment)

and the reason i used \_root.gotoAndPla(“section2”) is that there is a bug in flash that dosent allow you to directly go to a scene so you have to use a framelabel in the next scene and point to that.

yes if you have section2 in your main timeline, it would go to that, but just name it something original like “startscene2” and it will be ok

::: do u get it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 5:57am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/17 "2003-02-14T05:57:00Z")

</div>

Yeah i get it. thanks for your help!:pope:

```
      This coding stuff is giving me a headache but i do get it , just writing it is the worse , whats a good place i can learnt eh variables and commands and stuff like that?
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2003, 6:12am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/18 "2003-02-14T06:12:16Z")

</div>

right here on kirupa!! ask , search and look at fla’s, and learn .  
experimentation is the best advice i can give you!! 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 2:21am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/19 "2003-02-18T02:21:14Z")

</div>

ok , im busting my brains out… ive already did the code for the deloading of the movie… now lets say

i have another button and if they click on that one it loads something else??? im going insane im using the format u gave me but where do i put the new label and the code?? im going insane$#@()$()#@#@ ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh  
::hangover: :hangover: :hangover: :hangover: :hangover: :hangover: :hangover:

If i have scene2 and with the same buttons do i put a new label called end2 and then do that??? or what im really confused

do i still use

```php
if (content == 1) {
	_root.gotoAndPlay("pressreviews");
}
if (content == 5) {
	_root.gotoAndPlay("thirsty");
}
if (content == 2) {
	_root.gotoAndPlay("events");
}
if (content == 3) {
	_root.gotoAndPlay("smile");
}
if (content == 6) {
	_root.gotoAndPlay("munchies");
}
if (content == 7) {
	_root.gotoAndPlay("callus");
}

```

this is not in the main page this is from scene2(thirsty) so does th \_root level still apply?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 4:14am UTC](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476/20 "2003-02-18T04:14:19Z")

</div>

i think you are going the wrong way with this, if what your doing is making a website with scenes i would advice against it, simply use external movies, this way you could keep the menu of the main movie and just bring in section with a seperate external movie.

if this is the case check out this link

[http://www.kirupa.com/developer/mx/full\_site.htm](http://www.kirupa.com/developer/mx/full_site.htm)

and you can implement the code for closing animation into that.

it would be better to post your fla , so i can see what your trying to do. tell me how you go.

[Next page](https://forum.kirupa.com/t/q-on-buttons-and-frames-and-scenes/13476.md?page=2)
