Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

Text Loading & Movie

I know this one has been asked a buzillion times but all the post and references are confusing me.  I'm using MX 2004.

What I want to do is have a movie that contains a combo box (instance = pick_student).  Once an item is selected on the combo box, another movie (some swf) pops up in a container(initial_movie). I also want a selected text file (some text file) to load into a dynamic text container (instance = in_poem_text).

I'm not having any problems on the video but the text is driving me nuts.  Here's what I have on the combo box and I get no change in the in_poem_text instance but it throws no error and any traces don't produce the new text.  The in_poem_text instance is set to "dynamic text" with no variable name.  The txt file is formatted without any declarations or delimiters.

on (change) {
      hit_value = _root.pick_student.getValue();
      if (hit_value == "student1"){
            loadMovie("poem_student1.swf", _root.initial_movie)
            get_external_text = new LoadVars();
            get_external_text.load("student1.txt");
            get_external_text.onLoad = function(success) {
            in_poem_text.text = get_external_text
            }
            }
      else if (hit_value == "student2"){
            loadMovie("poem_student2.swf", _root.initial_movie)
      }
      else {
      }

}
0
skibama1
Asked:
skibama1
  • 2
  • 2
1 Solution
 
RedLavaCommented:
Hi hating_it,

Have you set the textfield to use embedded fonts?

RedLava
0
 
skibama1Author Commented:
How is that going to help?
0
 
rascalpantsCommented:
maybe you are having problems with your LoadVars()

try this:

get_external_text = new LoadVars();
get_external_text.onLoad = function(success) {
    in_poem_text.text = get_external_text
};

get_external_text.load("student1.txt");


you need to always have your onLoad function before your load  code...  

this might not be the problem, but it is worth trying...

rp
0
 
skibama1Author Commented:
That didn't work, but I keep seeing some references about the txt file being in a certain format.  I guess what is confusing me is that it seems like you would call the txt file into a variable and then set the instance (if text) to equal that variable but using LoadVars as an object is throwing me.
0
 
rascalpantsCommented:
I am not really understanding you...  but try this code instead of what you have:

get_external_text = new LoadVars();
get_external_text.onLoad = function(success) {
    in_poem_text.text = get_external_text.in_poem_text;
};

get_external_text.sendAndLoad("student1.txt", get_external_text, "POST");


I don't even fool around with "load" anymore, because I typically end up changing my code later anyway...

the above code will pull the variable "in_poem_text" from the  student1.txt  file...   this is how that text file should be set up...

in_poem_text=This is the text that is in the Poem.  I like cheese.&


If you are loading in more than one variable, then just set those up in your onLoad area just like I have for the single variable...

if you have a lot, then you should use sequential variables along with a for()  loop...


let me know if you need more help...

rp
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now