Input output information in text fields

The question is posed to me in my private messages… but I like to make my posts here so I’ve opted to just create a thread.

Just a quick question… how can I make contact between an input textbox inside a MC with a dynamic textbox outside of a MC?

Well… remember that I’m using 5.0… I don’t know much about MX’s structure. in 5.0, you’re not actually making any contact between text fields. Rather, a dynamic text field reads a variable and an input text field writes data to a variable. So…

If in the input text field you place something like

_root.myFirstVariableString

The root at the beginnging sends the data defined in the input text field to a variable on the main timeline called “myFirstVariableString”, AFTER the user has entered something, and hit enter on the keyboard, OR some sort of set up is made with a button. If you don’t place that “_root.” there then you’ll be defining the variable in the timeline that the text field is located in. You can use either method… but I prefer to stick almost all my variables on the main timeline. It just helps me to keep track of everything and not have to write out those addresses.

Now… the convenience of dynamics… Dynamic text fields read the variable which is located in their name field, including all _root, or _parent calls. So if we had a dynamic text field in any movie clip of our movie, no matter how deeply, if it’s name field had “_root.myFirstVariableString” in it, then it would read the variable set by the above input text.

When you add a button into the mix, it’s not hard to figure out how to do… you’re button provides a link between the text fields… send data from this timeline to that.

if you had a button, on a timeline of a movie clip and as well, you had an input text field. The input field has a name tag of ‘myVariable’. The button has the following code.

on(release){
_root.myOutPutMovieClip.output=myVariable;
}

What this is doing is setting a variable in a movie clip called “myOutPutMovieClip” which rests on the main timeline. In our movie clip we have a dynamic text field. It has a name tag of “output”. Which would read the variable ‘output’ from the timeline it rests on. Since it rests in the same place that the button sets the variable value, it picks up the variable as soon as it is set by the button in our other timeline.

Addressing is really quite easy once you get the hang of it… but that’s the only difficulty with text fields in and out… addressing where the variable is set, and addressing where the variable is read from.

I hope it helps. Like I said… my s/n is upuaut0 on AIM. If you need more explination, just give me a shout.

!! :o