Loading Text in dynamic text box

is it possible to load text into a dynamic text field, and if yes how could i do this?
i’ve searched a few tutorials on dynamic text fields but it conecntrates on scrolling.

i would like unique text to load in the dynamic text field depending on which navigation button i click on.
(i.e. i click on “button1” and “blabla1” text appears in the text field. i click on “button2” and blabla2" text appears in the same text field.)

i got help thx :slight_smile:

You got help?

So what’s the solution? I have the same problem now.

That’s pretty easy.

There are a couple of ways of doing this, but I’ll touch upon the basic method.

In your main timeline on one of the first frames, set some variables

myMsgOne=“Hi, how are you?”;
myMsgTwo=“Say my name, say my name.”;
myMsgThree=“the answer to life the universe and everything is 42”;
myMsgFour=“but what is the question?”;

Now, you have buttons (on the main timeline), with the following a/s

on(release){
myTextField=myMsgOne;
}
on(release){
myTextField=myMsgTwo;
}
on(release){
myTextField=myMsgThree;
}
on(release){
myTextField=myMsgFour;
}

Then in the text field (again, on the main timeline) you set the variable there to
myTextField

Hi,

I’m trying to do the same thing, except I use txt files. How can I get the files to dynamically load into the text field upon pressing the buttons?

Thanks!

good… that’s the really dynamic way of doing it. :slight_smile:

So… you’ve got a text file, I assume it has been formated correctly, but for the sake of newbies reading this, I’ll go over external text imported into Flash.

You can create text to be imported into Flash with a basic text editor, with the following format

&myFirstVariable=This is the text of my first variable&mySecondVariable=This is the text of my Second variable&myThirdVariable=This is the text of my Third variable&

we use & symbols at the beginning of each variable name, and then an equal sign to denote what the variable is equal too.

In this example we’ll say that we saved this as
“externalVariables.txt” and we’ve placed it in the same folder as the swf that is going to load it.

Now in the swf… in the first frame of the main timeline

loadVariables (“externalVariables.txt”);

this loads the txt file into the flash movie.
Now taking into account my post above, we could use this on the buttons.

on(release){
myTextField=myFirstVariable;
}
on(release){
myTextField=mySecondVariable;
}
on(release){
myTextField=myThirdVariable;
}

The variables have been placed in the root timeline.

It works, Thanks a lot!

now read my post in “the best of Kirupa” on loadVariables loadMovies, and the solution to the browser cache.

Thanks upuaut8.

Everything works fine except the text doesn’t always load with line 1 at the top. I’ll explain:

on press button1:
textfield = content of variable1 starting from line 1

on press button2:
textfield = content of variable2 starting from line 1

now if someone presses button1, scrolls down 5 lines and then presses button2, I have:

textfield = content of variable2 starting from line 5

What I’m trying to do is have the text always appear from line 1.

Any idea how to do this?

Thanks.