# Movie clip onRelase simple bug \[Help\]

**URL:** https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342
**Category:** Uncategorized
**Created:** [June 17, 2004, 2:14am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342 "2004-06-17T02:14:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![eze](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@eze](https://forum.kirupa.com/u/eze)
#### Post date: [June 17, 2004, 2:14am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/1 "2004-06-17T02:14:10Z")

</div>

I currently have this code on my button layer for all my four buttons

```auto

button_array = ["home","plans","terms","contact"];
for (var i in button_array){
this[button_array*].onRelease = function() {
 
 _root.fromName = [button_array*+"_mc"];
 content_mc.gotoAndPlay(36);
 };
}

```

And for every button it plays the home\_mc clip(i have an attachmoive command in content\_mc to attach \_root.fromName)

But what is strange is that when i edit the above code to -

```auto

button_array = ["home","plans","terms","contact"];
for (var i in button_array){
this[button_array*].onRelease = function() {
 
 _root.fromName = "plans_mc";
 content_mc.gotoAndPlay(36);
 };
}

```

Or another clip name it works… maybe someting wrong with my array?

---

<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: [June 17, 2004, 2:46am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/2 "2004-06-17T02:46:50Z")

</div>

Dynamic event handlers are object specific. Your i variable is not object specific, so they are reading it as all the same. What you should try doing is something like this…

```auto
button_array = ["home", "plans", "terms", "contact"];
for (var i in button_array) {
	btn = this[button_array*];
	btn.clip = this[button_array*+"_mc"];
	btn.onRelease = function() {
		_root.fromName = this.clip;
		content_mc.gotoAndPlay(36);
	};
}

```

---

<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: [June 17, 2004, 2:58am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/3 "2004-06-17T02:58:26Z")

</div>

hmm now it dont work for home\_mc either:( although it does gotoAndPlay(36)

---

<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: [June 17, 2004, 3:00am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/4 "2004-06-17T03:00:26Z")

</div>

in content\_mc it plays on load of page and stops at frame 35 with the actions -

```auto

stop();
_root.oldMClip = _root.fromName;
attachMovie(_root.fromName, _root.fromName, 1);

```

and then onRelease of a button it goes to and plays 36 with the code -

```auto

removeMovieClip(_root.oldMClip);

```

Thanks for ya help lostinbeta

---

<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: [June 17, 2004, 3:48am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/5 "2004-06-17T03:48:06Z")

</div>

bump

---

<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: [June 17, 2004, 3:50am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/6 "2004-06-17T03:50:21Z")

</div>

okay thanks lostinbeta for ya help but it stil not working - (this works)

```auto

button_array = ["home", "plans", "terms", "contact"];
for (var i in button_array) {
	btn = this[button_array*];
	btn.clip = this[button_array*]+"_mc";
	btn.onRelease = function() {
		_root.fromName = this.clip;
		content_mc.gotoAndPlay(36);
	};
}

```

This doesn’t -

```auto

button_array = ["home", "plans", "terms", "contact"];
for (var i in button_array) {
	btn = this[button_array*];
	btn.clip = this[button_array*]+"_mc";
	btn.onRelease = function() {
		_root.fromName = this.clip;
		content_mc.gotoAndPlay(36);
	};
}

```

The only difference is this -  
_btn.clip = this[button\_array]+"\_mc";_\* -not working  
**btn.clip = “home\_mc”;** -working

---

<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: [June 17, 2004, 4:15am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/7 "2004-06-17T04:15:21Z")

</div>

bump

---

<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: [June 17, 2004, 4:44am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/8 "2004-06-17T04:44:26Z")

</div>

come on gimme a lil 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: [June 17, 2004, 5:05am UTC](https://forum.kirupa.com/t/movie-clip-onrelase-simple-bug-help/113342/9 "2004-06-17T05:05:35Z")

</div>

- i sit here confused as a mofo \*

whilst the person with the answer sits out there doing their own thing unaware of the pain im going through…

come on:’(
