Mystified: setting a dynamic field = a variable

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:

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. :slight_smile:

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

:p:

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.