# Completley lost with movieclip-as-button actionscript

**URL:** https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969
**Category:** Uncategorized
**Created:** [February 16, 2004, 9:55pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969 "2004-02-16T21:55:22Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![cartoonfox](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@cartoonfox](https://forum.kirupa.com/u/cartoonfox)
#### Post date: [February 16, 2004, 9:55pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/1 "2004-02-16T21:55:22Z")

</div>

hi, i was in new york last week, so i’m out of practice and cant seem to get this working.  
i have this code on a movieclip.

```auto
on (rollOver) {
	this.gotoAndPlay("in");
}
on (rollOut) {
	this.gotoAndPlay("out");
}
on (releaseOutside) {
	this.gotoAndPlay("out");
}
on (press) {
	gotoAndPlay("main-out");
	chosen = "_root.home";
}

```

the rollover and rollout actions work, its just that when i press, it doesnt goto frame labelled “main-out” (which is the next frame from where this code is). instead, it plays the rollout animation. 😕

someone over at flashkit reccommended this, but it still didnt work.

```auto
onClipEvent (load) {
	onRollOver = function () {
		this.gotoAndPlay("in");
	};
	onRollOut = onReleaseOutside=function () {
		this.gotoAndPlay("out");
	};
	onPress = function () {
		gotoAndPlay("main-out");
		chosen = "_root.home";
	};
}

```

can anyone help???

thanks 🙂

---

<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 16, 2004, 11:14pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/2 "2004-02-16T23:14:07Z")

</div>

Hmm, what’s the instance name of this MC?

```auto

        INSTANCENAME.onRollOut = function () {
               INSTANCENAME.gotoAndPlay("out");
        };
        INSTANCENAME.onRollOver = function () {
               INSTANCENAME.gotoAndPlay("in");
        };
        INSTANCENAME.onReleaseOutside=function () {
                INSTANCENAME.gotoAndPlay("out");
        };
        INSTANCENAME.onPress = function () {
                _root.gotoAndPlay("main-out");
                chosen = "_root.home";
        };

```

- Try that, not sure though (untested).

---

<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 16, 2004, 11:32pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/3 "2004-02-16T23:32:32Z")

</div>

it needed an onclip handler, so i tried enterFrame, and it didnt even make the rollover work ☹

thanks for trying 🙂

---

<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 16, 2004, 11:35pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/4 "2004-02-16T23:35:01Z")

</div>

Dont put that on the movieclip, put that on the main timeline :).

---

<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 16, 2004, 11:37pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/5 "2004-02-16T23:37:50Z")

</div>

oh, lol  
ok, ta 🙂

---

<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 16, 2004, 11:38pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/6 "2004-02-16T23:38:46Z")

</div>

Did it work? No right?

---

<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 16, 2004, 11:40pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/7 "2004-02-16T23:40:12Z")

</div>

has the same effect, rollovers dont work ☹

thanks 🙂

---

<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 16, 2004, 11:44pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/8 "2004-02-16T23:44:20Z")

</div>

on what timeline is the frame “main-out” located? if it’s within  
the MC itself, try putting ‘this.’ in front of all your commands.

like this:  
[AS]on (press) {  
this.gotoAndPlay(“main-out”);  
chosen = “\_root.home”;  
}[/AS]  
if the frame you want to play is on the main timeline, put \_root instead. hope that 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 16, 2004, 11:45pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/9 "2004-02-16T23:45:38Z")

</div>

Thats wat im wondering.

---

<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 16, 2004, 11:52pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/10 "2004-02-16T23:52:28Z")

</div>

ok, sorry. i’ll try to explain where evrything is 🙂

i have a mc called “main” which is placed on the root stage. (just to make the whole file neater :)) and in this movieclip is another mc, which is the menu button, but its a movieclip.  
the label “main-out” is “main” mc, not the button mc.

so the label “in” and “out” are in the menu mc, which is why i have this.  
but the “main-out” label is not on the root, but in the same stage as the menu mc, which is why \_root. wont work.

hope thats help a bit. if not, i can try to upload the fla. but some people have trouble opening my fla’s as i use a mac.

thanks 🙂

---

<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 17, 2004, 12:06am UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/11 "2004-02-17T00:06:28Z")

</div>

Do you really need a clip event? On the MC of the button (not the main root one but the second one), add these actions:

```auto
onClipEvent (enterframe) {
        onRollOver = function () {
                _root.main.gotoAndPlay("in");
        };
        onRollOut = function () {
               _root.main.gotoAndPlay("out");
        };
        onReleaseOutside = function () {
              _root.main.gotoAndPlay ("out");
        };
        onPress = function () {
                _root.main.gotoAndPlay("main-out");
                chosen = "_root.home";
        };
}

```

And then make sure that the main mc’s instance name is **main**.

---

<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 17, 2004, 12:12am UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/12 "2004-02-17T00:12:17Z")

</div>

nope, still doesnt work. ☹

this is srange, i’ve used this code before and it worked.

```auto
on (rollOver) {
        this.gotoAndPlay("in");
}
on (rollOut) {
        this.gotoAndPlay("out");
}
on (releaseOutside) {
        this.gotoAndPlay("out");
}
on (press) {
        getURL("http://www.myurl.com");
}

```

so it must be something to do with the gotoAndPlay code.

---

<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 17, 2004, 12:14am UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/13 "2004-02-17T00:14:18Z")

</div>

How about without the clipEvent then if that worked :):

```auto
onRollOver = function () {
                _root.main.gotoAndPlay("in");
        };
        onRollOut = function () {
                _root.main.gotoAndPlay("out");
        };
        onReleaseOutside = function () {
                _root.main.gotoAndPlay ("out");
        };
        onPress = function () {
                _root.main.gotoAndPlay("main-out");
                chosen = "_root.home";
        };

```

---

<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 17, 2004, 12:17am UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/14 "2004-02-17T00:17:54Z")

</div>

ok, but why is “in” have \_root.main? shouldnt it be just this. ?

and the “main-out” label isnt on the \_root. its on the same mc as the button is on, its the next frame actually. 🙂

---

<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 17, 2004, 12:23am UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/15 "2004-02-17T00:23:58Z")

</div>

hey sharif, chek your pm’s 😉

---

<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, 2004, 12:16pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/16 "2004-02-18T12:16:05Z")

</div>

To make it a little more clear, post your fla:)  
(or upload it, seems that the attachments are not working at the moment)

scotty(-:

---

<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, 2004, 5:03pm UTC](https://forum.kirupa.com/t/completley-lost-with-movieclip-as-button-actionscript/42969/17 "2004-02-18T17:03:08Z")

</div>

ok, here’s the url.  
[edit] resolved now

thanks 🙂
