# Button in a movie clip

**URL:** <https://forum.kirupa.com/t/button-in-a-movie-clip/25798>\
**Category:** Uncategorized\
**Created:** [July 16, 2003, 4:24pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798 "2003-07-16T16:24:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![staykeeter](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@staykeeter](https://forum.kirupa.com/u/staykeeter)\
**Post date:** [July 16, 2003, 4:24pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/1 "2003-07-16T16:24:11Z")

</div>

Can a button that is inside of a movie clip target a dynamic text field. Im currently working with the “infinate menu” tutorial on this site and I want to be able to click on one of the moving buttons to bring up text for that button in a dynamic text field. Does anyone know how to 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:** [July 16, 2003, 4:26pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/2 "2003-07-16T16:26:56Z")

</div>

Yes it is possible.

---

<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:** [July 16, 2003, 4:42pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/3 "2003-07-16T16:42:54Z")

</div>

In case you dont know:[AS]on (release) {  
loadText = new loadVars();  
loadText.load(“yourtextfile.txt”);  
loadText.onLoad = function(OK) {  
if (OK) {  
myTextField.text = this.text;  
} else {  
trace(“Error”);  
}  
};  
}[/AS]Where _myTextField_ is your textfield instance name and _text_ is the variable inside the txt file.

---

<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:** [July 16, 2003, 4:50pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/4 "2003-07-16T16:50:29Z")

</div>

thank you , I’ll give it a try now

---

<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:** [July 16, 2003, 5:01pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/5 "2003-07-16T17:01:47Z")

</div>

I tried your script but still no luck. I can see the dynamic text box(as i have enabled “show border around text”) but it just stays blank when i click on the button. Everything works if i just put a normal button on the stage and add the script, but not when its in a movie clip, it just will not 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:** [July 16, 2003, 5:06pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/6 "2003-07-16T17:06:55Z")

</div>

You have to give the right path to the textfield. If its inside a movie clip called _movieclip\_mc_:[AS]moviclip\_mc.myTextField.text = this.text;  
[/AS]

---

<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:** [July 16, 2003, 5:07pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/7 "2003-07-16T17:07:37Z")

</div>

is the text field inside the MC? it drove me crazy for a while - be sure to put \_root.myTextFieldInstanceName if it’s on the stage by itself or \_root.myMCInstanceName.myTextFieldInstanceName if not…

---

<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:** [July 16, 2003, 5:17pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/8 "2003-07-16T17:17:06Z")

</div>

Excellent… I was missing the “\_root.” I cant believe I just spent a full day fiddling with this when thats all it was … This can be such a frusterating program at times and it’s great that people stop in to help out… Thanks again

---

<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:** [July 16, 2003, 5:18pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/9 "2003-07-16T17:18:36Z")

</div>

Yes, i know that can be a pain in the as$ 😛  
Get more confortable with \_root, \_parent and this.  
It will help you a lot.

---

<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:** [July 16, 2003, 6:12pm UTC](https://forum.kirupa.com/t/button-in-a-movie-clip/25798/10 "2003-07-16T18:12:42Z")

</div>

i’ll second that… first time i had to add dynamic text fields inside an MC it was so frustrating and then i realized: \_root! i don’t even use \_parent anymore unless the hierarchy is very deep - i usually just use \_root.mc1.mc2 so that i’m always thinking from the top level down to whatever i’m working on.

glad you got it working!
