# How to do this?

**URL:** https://forum.kirupa.com/t/how-to-do-this/20380
**Category:** Uncategorized
**Created:** [May 8, 2003, 3:22am UTC](https://forum.kirupa.com/t/how-to-do-this/20380 "2003-05-08T03:22:24Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![aynneo](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@aynneo](https://forum.kirupa.com/u/aynneo)
#### Post date: [May 8, 2003, 3:22am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/1 "2003-05-08T03:22:24Z")

</div>

I want when a button is pressed, it goes to play a certain frame(frame121) then when it reaches (frame130), it goes to play anotherframe. I have ten buttons but the problem is that all 10 buttons must play from frame 121 to frame 130 if it is pressed. And from that point on, each button if pressed will play different frame( let say button1 play frame 131, but2 play 140, but3 play151…) I juz can’t figure it ut how to do it. Any 1 pls help?

---

<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: [May 8, 2003, 3:40am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/2 "2003-05-08T03:40:49Z")

</div>

you could use a flag…

ie. in the button1 actions:

```auto
on (release) {
if (!flag) {
gotoAndPlay(121);
flag++;
} else {
gotoAndPlay(131);
}
}

```

=)

---

<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: [May 8, 2003, 3:50am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/3 "2003-05-08T03:50:28Z")

</div>

put the buttons on a separate layer and then hit insert frame on the last frame of your movie or wherever you want the buttons to end.

I think that is more of what you are looking for (but I have been wrong once or twice before)

good luck flashhead,  
\_root.brian2

---

<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: [May 8, 2003, 3:58am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/4 "2003-05-08T03:58:09Z")

</div>

I am quite new to flash.Is it that all i have to do is place the script on the button? Or do i have to make a “flag” how should i go about 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: [May 8, 2003, 4:01am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/5 "2003-05-08T04:01:14Z")

</div>

> \*Originally posted by brian monkey \*  
> \*\*put the buttons on a separate layer and then hit insert frame on the last frame of your movie or wherever you want the buttons to end.

I think that is more of what you are looking for (but I have been wrong once or twice before)

good luck flashhead,  
\_root.brian2 \*\*

I think u got it wrong. what i want is something like what kax has describe, but dun noe about the “flag” dinggy.

---

<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: [May 8, 2003, 4:04am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/6 "2003-05-08T04:04:28Z")

</div>

yeah… you use it as is.

the only thing you may need to change is rename the flag.

button1 actions:

```auto
on (release) {
if (!button1Flag) {
gotoAndPlay(121);
button1Flag++;
} else {
gotoAndPlay(131);
}
}

```

button2 actions:

```auto
on (release) {
if (!button2Flag) {
gotoAndPlay(121);
button2Flag++;
} else {
gotoAndPlay(131);
}
}

```

that should work… 😉

---

<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: [May 8, 2003, 4:05am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/7 "2003-05-08T04:05:37Z")

</div>

And by the way my buttons are all on a differnt layer

---

<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: [May 8, 2003, 4:46am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/8 "2003-05-08T04:46:54Z")

</div>

hey man! try this one:

1. 

button1 action:  
on (release) {  
gotoThatFrame = 1;  
gotoAndPlay(121);  
}  
button2 action:  
on (release) {  
gotoThatFrame = 2;  
gotoAndPlay(121);  
}  
and so on…  
3. on frame 130, put this code:  
ifFrameLoaded(1) {  
if (gotoThatFrame==1) {  
gotoAndPlay whatever u like…  
}  
if (gotoThatFrame==2) {  
gotoAndPlay whatever u like…  
}  
if {  
…continue until gotoThatFrame == 10  
}  
}  
5. That’s 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: [May 8, 2003, 5:07am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/9 "2003-05-08T05:07:56Z")

</div>

> \*Originally posted by kax \*  
> \*\*yeah… you use it as is.

the only thing you may need to change is rename the flag.

button1 actions:

```auto
on (release) {
if (!button1Flag) {
gotoAndPlay(121);
button1Flag++;
} else {
gotoAndPlay(131);
}
}

```

button2 actions:

```auto
on (release) {
if (!button2Flag) {
gotoAndPlay(121);
button2Flag++;
} else {
gotoAndPlay(131);
}
}

```

that should work… 😉 \*\*

Cannot work.  
When release, for the 1 button, it works fine but not for the others. They juz play the frame 131 to 140. But i dun want it to play 131 to 140 for the rest of the buttons.

---

<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: [May 8, 2003, 6:27am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/10 "2003-05-08T06:27:53Z")

</div>

hey man! try this one:

1. 

button1 action:  
on (release) {  
gotoThatFrame = 1;  
gotoAndPlay(121);  
}  
button2 action:  
on (release) {  
gotoThatFrame = 2;  
gotoAndPlay(121);  
}  
and so on…  
3. on frame 130, put this code:  
ifFrameLoaded(1) {  
if (gotoThatFrame==1) {  
gotoAndPlay whatever u like…  
}  
if (gotoThatFrame==2) {  
gotoAndPlay whatever u like…  
}  
if {  
…continue until gotoThatFrame == 10  
}  
}  
5. That’s 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: [May 8, 2003, 8:44am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/11 "2003-05-08T08:44:31Z")

</div>

> \*Originally posted by rvanet \*  
> \*\*hey man! try this one:

1. 

button1 action:  
on (release) {  
gotoThatFrame = 1;  
gotoAndPlay(121);  
}  
button2 action:  
on (release) {  
gotoThatFrame = 2;  
gotoAndPlay(121);  
}  
and so on…  
3. on frame 130, put this code:  
ifFrameLoaded(1) {  
if (gotoThatFrame==1) {  
gotoAndPlay whatever u like…  
}  
if (gotoThatFrame==2) {  
gotoAndPlay whatever u like…  
}  
if {  
…continue until gotoThatFrame == 10  
}  
}  
5. That’s it! \*\*

THAT’S IT MY FRIEND YOU ARE AMAZING!!!  
THX!!!

---

<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: [May 8, 2003, 8:53am UTC](https://forum.kirupa.com/t/how-to-do-this/20380/12 "2003-05-08T08:53:34Z")

</div>

No problem! :thumb:

Cheers!
