# Loading dynamic text into button instance

**URL:** <https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851>\
**Category:** flash\
**Created:** [August 19, 2003, 12:23pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851 "2003-08-19T12:23:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danii](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@Danii](https://forum.kirupa.com/u/Danii)\
**Post date:** [August 19, 2003, 12:23pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/1 "2003-08-19T12:23:40Z")

</div>

Okey, Ive created a button which has a dynamic text field in it.  
Is there a way to load text into tht text field…  
The text is beeing loaded from a mysql db using php.

:thumb:

---

<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:** [August 19, 2003, 1:36pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/2 "2003-08-19T13:36:46Z")

</div>

It is possible. I’ve used it before on a project for my father. Depending on how you are loading in the variable(s), you have to target the textbox in the button like:

```auto
_root.buttoninstance.textboxname = variable

```

Is that what you’re asking?

---

<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:** [August 19, 2003, 1:51pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/3 "2003-08-19T13:51:04Z")

</div>

okey Ive tried ur way but it wont load  
this is my script for loading the text  
[AS]  
$lv = new loadVars();  
$lv.load(“[http://myhost.nu/get\_text.php?menu=fakta&ruta=fakta\_txt](http://myhost.nu/get_text.php?menu=fakta&ruta=fakta_txt)”)  
//fakta\_txt is the var and instancename of my txtfield  
$lv.onLoad = function() {  
snurr.\_alpha = 0; //never mind this one  
\_root.daniibut.fakta\_txt = $lv.danii\_ladd  
}  
[/AS]  
I used this names and vars without putting the txtfield in a button and the text is loaded perfectly, so it cant be something wrong with my php script or anything…

---

<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:** [August 19, 2003, 1:59pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/4 "2003-08-19T13:59:06Z")

</div>

I’m gonna have to go home and check my code because I don’t have Flash at work. I’ll get it for you. Here’s part of an example of what I did. The text on the buttons is loaded in from a text file with the loadVars method, so that should be the same:

[http://www.freddythunder.com/dad/buttons.html](http://www.freddythunder.com/dad/buttons.html)

Hang on!!

---

<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:** [August 19, 2003, 2:00pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/5 "2003-08-19T14:00:56Z")

</div>

Aight =]  
thx a lot!  
ill be waiting.

=) :thumb:

---

<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:** [August 19, 2003, 2:55pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/6 "2003-08-19T14:55:26Z")

</div>

It’s rainy and I’m really tired and at work, so as I was about to fall asleep at work I was thinking of the problem 😛

First, you should take a look at this:  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31032&highlight=loadvars](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31032&highlight=loadvars)  
This talks about loading vars into an object vs loading them onto the timeline.

After looking at your script, it should work. if your button is called ‘daniibut’. I’m still going to have to check that other thing. Is there anyway you can post your fla and PHP?

---

<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:** [August 19, 2003, 3:48pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/7 "2003-08-19T15:48:33Z")

</div>

Hey thx a lot thunder it works fine 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:** [August 19, 2003, 4:30pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/8 "2003-08-19T16:30:34Z")

</div>

What did you change to make it 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:** [August 19, 2003, 5:51pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/9 "2003-08-19T17:51:03Z")

</div>

Not much, the var was mispelled ^-^

---

<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:** [August 19, 2003, 10:38pm UTC](https://forum.kirupa.com/t/loading-dynamic-text-into-button-instance/28851/10 "2003-08-19T22:38:44Z")

</div>

That’ll do it!!😛
