There was a time when Flash was used exclusively for timeline-based animations. However, many current Flash applications—even simple ones—load and send data to and from external resources. For example, a simple web site built in Flash might display news. In order to keep the news fresh, it’s important to be able to load the text from an external resource, such as a text file or from a PHP page that retrieves the data from a database. If you have a comments form, you’ll need to send data to a script. There are many potential uses of such data in Flash applications.
To work with data most effectively, you’ll need to use ActionScript. In a few cases, the ActionScript will be relatively simple. For example, if you want to load variables from an external resource, the solution involves ActionScript as discussed in Recipe 19.1. However, there are also mechanisms for working with data in basic ways that do not require ActionScript. In this chapter, you’ll read about solutions that use simple and/or minimal ActionScript. Non-ActionScript solutions are discussed where appropriate.
You want to load variables at runtime.
LoadVars object. Call the load( ) method.
There are many reasons you might want to load variables at runtime. Loading variables at runtime makes applications more dynamic than they would be if you had to hardcode all values into the file. For example, if your application displays a new quote or snippet ...