PDA

View Full Version : loading ext text in a mc



Superfrappe
September 17th, 2003, 09:33 AM
Hi all,

This is probably a simple one, but for some reason, i'm just stuck.

All i'm trying to do is load external text from a .txt file into a mc. I have everything named properly, and when i test it in flash (flash preview) it works fine. When I upload it to the server, the text won't load. I made sure the path is correct, but I feel like I'm missing something. I did this a few years ago, but I forgot the code, and don't have the .fla anymore.

Since the text is to be loaded into a mc that is in another mc, is the path different, or is it nested? I did a search in the forums and haven't find anything to help me yet.

I appreciate all replies. Thanks!

claudio
September 17th, 2003, 09:41 AM
loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {
myTextField.text = this.myVar;
}else{
trace("Error");
}
};
loadText.load("textfile.txt");- textfile.txt is your txt file;
- myVar is the variable inside your txt file;
It should look like this: myVar=bla bla bla bla bla whatever you want here&
- myTextField is the instance name of your textfield;
if your textfield is inside a movie clip, replace the last line for:
myMovieClip.myTextField.text = this.myVar;- Where myMovieClip is the instance name of the movie clip with the textfield inside

Superfrappe
September 17th, 2003, 10:32 AM
claudio, thanks so much for your reply. i actually had seen your previous post to another member about this subject in a forum search i did yesterday. although, i still can't get it to work.

When you click on "services" the movie loads on top, which resides in the "empty" mc in the "main" movie. The "services" movie loads fine, but just refuses to load the text.

I have the .txt fil read "myText = blah blah blah..."

What am I doing wrong!

Thanks claudio! :)

claudio
September 17th, 2003, 12:14 PM
Here

Superfrappe
September 17th, 2003, 01:33 PM
claudio, thank you kindly. :}

claudio
September 17th, 2003, 02:42 PM
welcome ;)