Problem loading text into a MC
I'm trying to load a text file into a my flash movie with the use of a button. I can get it to work if the text field and the button are on the SAME timeline or movie clip. My problem is when the button and the text box are in DIFFERENT movie clips.
Here's the code I'm using:
on (release) {
LoadVarsText = new LoadVars();
LoadVarsText.load("story1.txt");
//assign a function which fires when the data is loaded:
LoadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
stories.text = this.story;
} else {
trace("not loaded");
}
};
}
The Problem is the 'stories' text box is located in a movie clip called 'text_mc' and the button is on the main/root timeline. I thought the following would work but it doesn't...the output says "done loading" but nothing shows up.
on (release) {
loadVarsText = new loadVars();
loadVarsText.load("story1.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
this.text_mc.stories.text = this.story;
} else {
trace("not loaded");
}
};
}
Need some help.....Thanks!!!!
|