First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Patrick Mineault

The first thing that we added is the loadVariables statement. This loads the variables from the text.txt file. Now, when Flash opens the text file, it sees daTextBox=blablabla, so it sets the internal variable daTextBox to «blablabla». Note that we use the "this" operator, which refers to the current clip, to show Flash that we want the variables loaded into containerMC, not in the main timeline or in some other clip.

This single line asks Flash to load the text file into the movie. When the text is on a server, Flash has to make a connection to it and retrieve the data. This takes time. Now, it's useful to know when the text has finished loading. You might want to do something when the text is loaded, like play a "tada" sound, for example.

Hence, we introduce yet another clip event, data. The data clip event is fired immediately after a text file is loaded with loadVariables. So when the data clip event is fired, we know the file is loaded into Flash.

It's not enough, however, to know that the text file is loaded. You see, when Flash loads a text file into a movie, it must parse the file, and parsing takes time. So even though our text file is loaded, Flash might only fill the textbox one or two frames later.

So what is done is, at first, the needInit variable is set to false. When the textfile is loaded, the data clip event is fired, and the variable needInit is set to true. In our enterFrame clip event, this fires an if condition. This if checks whether or not the textbox's maxscroll property has been updated. If it has been updated, it should be bigger than 1, and that means is text is both loaded and parsed.

Right now, there's only a comment in there that says "Text is loaded!". Later, when the scrollbar is added, we'll fire an event when we know the textfile is loaded and parsed to change the height of our scrolbar. Confused? Maybe a diagram will help:

That wasn't too hard now, was it? It's time for some hardcore ActionScript.

» Level Intermediate

Added: 2001-07-17
Rating: 8 Votes: 176
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.