# \[MX'04 PRO - AS 2.0\] Scope question

**URL:** <https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991>\
**Category:** flash\
**Created:** [September 12, 2004, 7:31am UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991 "2004-09-12T07:31:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbuff](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kbuff](https://forum.kirupa.com/u/kbuff)\
**Post date:** [September 12, 2004, 7:31am UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/1 "2004-09-12T07:31:54Z")

</div>

[font=Times New Roman]Ok, on a scene I have a movieclip, let’s call it “movie\_mc” that has some button on it, “button\_mc”. So the button is on the movieclip, not on the frame by itself.[/font]

[font=Times New Roman]In the frame’s code I want to write a function for when the button is released, but can’t seem to get the proper path to the button\_mc. I’ve tried:[/font]  
[font=Times New Roman]

```auto
[/font]
[font=Fixedsys]_root.movie_mc.button_mc.onRelease = function(){ /* code here */}[/font]
[font=Fixedsys]movie_mc.button_mc.onRelease = function(){ /* code here */}[/font]
[font=Fixedsys]button_mc.onRelease = function(){ /* code here */}[/font]
[font=Fixedsys]_root.button_mc.onRelease = function(){ /* code here */}[/font]
[font=Times New Roman]

```

[/font]

[font=Times New Roman]None of these however trigger the code when I press the button. If the movieclip is converted into a Graphic, then the 3rd line of code works. However, this isn’t an option because I really need it to be a movieclip. Any help?[/font]

---

<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:** [September 12, 2004, 9:03am UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/2 "2004-09-12T09:03:48Z")

</div>

1 and 2 should work. Double check instance name spelling. and try traces to see if the clip exists

trace(\_root.movie\_mc.button\_mc);

---

<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:** [September 13, 2004, 9:25pm UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/3 "2004-09-13T21:25:50Z")

</div>

> [@senocular](#):
>
> 1 and 2 should work. Double check instance name spelling. and try traces to see if the clip exists
> 
> trace(\_root.movie\_mc.button\_mc);

No dice. I’ve triple- and quadruple-checked the spelling. I even verified the variable name using the debugger variable listing.

Does it matter that the buttons only appear on the last frame of the movieclip? How it works is the movieclip plays an animation, and on the last frame, the buttons appear, and the movieclip is stopped on that frame. So I can see the buttons… even the Up/Over/Down visualizations work for them… just no response when I click on them.

I’m stuck.

---

<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:** [September 13, 2004, 9:42pm UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/4 "2004-09-13T21:42:31Z")

</div>

did you try to just put

```auto

on (release) {
      do 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:** [September 13, 2004, 9:52pm UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/5 "2004-09-13T21:52:14Z")

</div>

> Does it matter that the buttons only appear on the last frame of the movieclip?

Of course it matters :).  
Put the code either on your last frame where your movie\_mc stops

```auto
button_mc.onRelease = function(){ /* do something */}
_root.movie_mc.button_mc.onRelease = function(){ /* this should work also */}

```

or on the button it’self something like:

```auto

on (Release) {
//do something
}

```

---

<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:** [September 14, 2004, 2:31am UTC](https://forum.kirupa.com/t/mx04-pro-as-2-0-scope-question/63991/6 "2004-09-14T02:31:46Z")

</div>

yes, guys, putting code on the button works. However, unfortunately, it isn’t a plausible solution to my problem. For one, it fragments the code which I want to avoid.

More importantly, I need to reference the button in other parts of code (such as when I want to enable/disable the button, etc), not just perform the onRelease procedures.

Doesn’t make sense to me that when the buttons are obviously on the screen, I can click on them but nothing happens even though the variable name is correct.
