# 4 buttons -----\> one function!

**URL:** <https://forum.kirupa.com/t/4-buttons-one-function/38880>\
**Category:** Uncategorized\
**Created:** [December 31, 2003, 2:49am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880 "2003-12-31T02:49:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashSwimmer](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@FlashSwimmer](https://forum.kirupa.com/u/FlashSwimmer)\
**Post date:** [December 31, 2003, 2:49am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/1 "2003-12-31T02:49:15Z")

</div>

hi guys,  
i’ve 4 buttons in the main root… :}  
and if any of them clicked tell mc\_main to gotoAndPlay(“mainon”).  
mc\_main is a movie clip contains from 20 frames if any buttons clicked it’s appear. :sure: and if i click on it .  
… it disappear.  
it’s ok for one button but if i clicked 2 or 3 buttons before click  
on it.  
so i create this function  
[AS]onClipEvent (load) {  
function homeClick() {  
if (mc\_main.\_currentframe == 10) {  
// i don’t know what i’ve to write here  
} else {  
\_root.mc\_main.gotoAndPlay(“mainon”);  
}  
}  
}[/AS]  
it works greate but if the \_currentframe ==10 what supose to happen:h:

---

<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:** [December 31, 2003, 3:08am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/2 "2003-12-31T03:08:11Z")

</div>

> it’s ok for one button but if i clicked 2 or 3 buttons before click  
> on it.

well, what happens to it? can you post your fla? What exactly do you want to happen?

---

<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:** [December 31, 2003, 3:09am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/3 "2003-12-31T03:09:27Z")

</div>

it disappear… ☹

---

<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:** [December 31, 2003, 3:11am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/4 "2003-12-31T03:11:41Z")

</div>

here is the file… :sure:  
have a look in my code… i think you can mangment it… i don’t know how to make it easy and more prof. :hangover:

---

<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:** [December 31, 2003, 3:29am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/5 "2003-12-31T03:29:30Z")

</div>

like this? or diff?

---

<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:** [December 31, 2003, 3:33am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/6 "2003-12-31T03:33:59Z")

</div>

thanx for your help but your function is more complicated :puzzle:  
why you change all \_root -----\> \_parent :h:  
can you explain it to me :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:** [December 31, 2003, 3:38am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/7 "2003-12-31T03:38:27Z")

</div>

good coding habits 🙂 find and replace… bam. _lol_

it’s just a reverse script. it reverses the animation no matter what frame it’s on. I was just a little unsure of what exactly you wanted. Oh and you had actions definitions on an onEnterFrame so i put them on the onLoad, What you were doing is defining what the buttons should do over and over again, but you only need to define them once.

---

<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:** [December 31, 2003, 4:22am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/8 "2003-12-31T04:22:31Z")

</div>

norie you didn’t solve the problem… ;(  
i think you don’t understand what i want to do :q:  
ok… i want when you click on any buttons tell mc\_main to appear… this movie to return to the main interface so if you click on another button… that doesn’t effect the mc\_main… finaly if you want to return to the main interface click on mc\_main for return and disappear itself in the same time.

i hope you get it :sure:

---

<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:** [December 31, 2003, 5:31am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/9 "2003-12-31T05:31:37Z")

</div>

```auto
function homeClick() {
		if (_root.mc_main._currentframe != 10) {
			_root.mc_main.play();
		}
	}

```

:h:

you want it so that if you click any of the square buttons it plays (mc\_main) and if you click on the home button it disapears?

---

<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:** [December 31, 2003, 11:36am UTC](https://forum.kirupa.com/t/4-buttons-one-function/38880/10 "2003-12-31T11:36:21Z")

</div>

:thumb: :thumb: :thumb: :thumb:  
it’s working now as i wash :}

many thanx norie for your help. 🍺
