The loadVariablesNum() Method
The loadVariablesNum() method is similar to the loadVariables() method in that it loads external variables into Flash, but unlike the loadVariables() method, the loadVariablesNum() method loads the variables into a level instead of directly into a movie clip.
The basic layout of this method looks like this:
loadVariablesNum(URL, level, method);
Following are the parameters that loadVariablesNum will accept:
It also supports the onData event as a means of announcing when data has been fully loaded.
Here is an example using the loadVariablesNum() method:
Notice that this time, we use a conditional statement to make sure that the event is not accidentally being triggered by the main timeline's initialization. Also notice that we are calling the original text file we created, not the one we used to put in an array.
Now test the movie, and you will see in the Output panel the same text that was in Figure 20.4.
But the two methods we have covered in regard to loading external data are not the end. There is even a built-in object specifically designed for interfacing with external data.