# Mystified: setting a dynamic field = a variable

**URL:** <https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435>\
**Category:** Uncategorized\
**Created:** [July 27, 2004, 1:49pm UTC](https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435 "2004-07-27T13:49:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xMetal](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xMetal](https://forum.kirupa.com/u/xMetal)\
**Post date:** [July 27, 2004, 1:49pm UTC](https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435/1 "2004-07-27T13:49:39Z")

</div>

OK, I am totally stumped. I should also mention from the outset that I’m a pretty advanced user here, and have done the following literally a thousand times, hence my utter confusion.

Here’s the story:

1- Load data from XML file, parse it, assign root level variables to the data bits. This is fine, running in debugger shows all my variables are there.

2- I have a dynamic text field at the root level, called “instructions”

3- On frame one, in part of my script I simply set \_root.instructions = \_root.general\_help; (one of my variables from the XML)

4- Nothing displays.

If I manually set \_root.instructions = “blah blah blah”; it displays no problem.

If I put another dynamic text field on the same frame, on the same layer as instructions and assign it the variable \_root.general\_help, this works and displays the proper text.

If I throw a button on stage and set it to onRelease-\> \_root.instructions = \_root.general\_help; this works as well.

So what the heck is going on? This is as simple as you can get, and compared with the other things going on in this program it’s, like, a negative number on the 1-10 difficulty scale.

Totally confused. :pa:

---

<div class="post-metadata">

**Author:** ![kode](https://avatars.discourse-cdn.com/v4/letter/k/97f17d/32.png) [@kode](https://forum.kirupa.com/u/kode)\
**Post date:** [July 27, 2004, 3:31pm UTC](https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435/2 "2004-07-27T15:31:40Z")

</div>

Make sure that the variable has been defined (that is, after the XML file has been loaded and parsed). You could use the [font=courier new]XML.onLoad[/font] event handler to do that. 🙂

---

<div class="post-metadata">

**Author:** ![bodyvisual](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bodyvisual/32/564_2.png) [@bodyvisual](https://forum.kirupa.com/u/bodyvisual)\
**Post date:** [July 27, 2004, 3:33pm UTC](https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435/3 "2004-07-27T15:33:45Z")

</div>

myTextField. **text** might work… also, you have to embed the font outline for dyn. txt boxes.

:p:

---

<div class="post-metadata">

**Author:** ![xMetal](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xMetal](https://forum.kirupa.com/u/xMetal)\
**Post date:** [July 27, 2004, 4:42pm UTC](https://forum.kirupa.com/t/mystified-setting-a-dynamic-field-a-variable/117435/4 "2004-07-27T16:42:22Z")

</div>

well, it was apparently some kind of wierd timing issue. I tried a whole variety of things, including an onLoad Success kind of thing, and none of that worked.

On a whim, I threw the \_root.instruction = \_root.general\_help right into the XML loading part of the script, directly after the part that parsed the XML and set the variables. That worked.

Why, I have no idea. I made sure initially to have the script after the XML stuff, as I know flash loads and goes thrugh the AS top-down, so why it wouldn’t work as I had it is a mystery.

Oh well, chalk that up to experience.
