I am a new member and fairly new to AS but I am hoping that someone might be able to help me out. I am loading a image into a MC from a text file and I have got it working okay but now I would like to make it into a function. I have code that I though would work, but the image is no longer loading.
This is the working code
loadText = new LoadVars();
loadText.load("data.txt");
loadText.onLoad = function() {
name.text = this.name;
loadMovie(this.image, empty_MC);
};
Contents of the data.txt file
&name=Dan
&image=1.jpg
Non-working function
function test() {
loadText = new LoadVars();
loadText.load("data.txt");
loadText.onLoad = function() {
name.text = this.name;
loadMovie(this.image, empty_MC);
}
};
I am pretty sure that it has something to do with the loadText.onLoad = function() { line.
Any ideas?
Thanks,
Dan