Sorry about that. I guess you need to know how to import a text file and all that. Well there are some helpful tutorials on this site that will guide you through the process of importing text.
I'll give some insight along with some tidbits of code that will help you understand the tutorials you should read after this.
First things first. Formatting data to be loaded into Flash. Well there are a few ways to go about this, the easiest being URL encoded text file. This is easiest because Flash automatically parses it and browsers automatically format it.
A URL encoded text file is in this form.
?name=Ken Elliott&likes=camels&age=24
(look at the address in your address bar right now. Everything after php3? are variable definitions being passed to the php program)
? simply tells flash that everything after it is url encoded and Flash should parse it.
name,likes & age are variable names
Ken Elliott,camels & 24 are values attached to the variables.
You can use the LoadVars object to load an external text file into flash. For testing we will say that the above URL encoded text is in a text file called 'info.txt'.
ActionScript Code:
// here I simply create a new LoadVars object
myInfo = new LoadVars();
// now I load our text file into my new
// loadVars object
myInfo.loadVars("info.txt");
// and you can't access the information until
// it has finished loading so i utilize
// the onload event to trigger it to
// move the _root playhead to the frame
// number corresponding to my age (24)
myInfo.onLoad = function () {
// I use Number() to ensure that it is
// a number
_root.gotoAndStop(Number(this.age));
}
See what is going on here? When I load the information into my loadVars object flash automatically parses the URL encoded text and assigns it in the scope of that object. So I can access all of the variables in that text file by referencing the loadVars object.
ActionScript Code:
trace(myInfo.name); // Ken Elliott
trace(myInfo.likes); // camels
trace(myInfo.age); // 24
Hope that helps.
web