8 Replies Latest reply on Jun 18, 2006 4:52 PM by kglad

    LoadVars

    hushhurt
      this is driving me mad. i am using flash mx 2004 (on mac)
      I have the text file named "news.txt" in the same folder and my published swf file, but it will not load it, it just gives me a blank text box.

      in the text file i assigned the text: info=this is my text.

      and the dynamic text field is named "myText"

      i have an intro, so the text field doesnt show up until the 60th frame, which is where i placed the actionscript - does this matter?

      here is my code:

      var myLV:LoadVars = new LoadVars();

      myLV.onLoad = function(success) {
      if (success) {
      myText.htmlText = myLV.info;
      } else {
      myText.text = "There was an error when loading the external file.";
      }
      };

      myLV.load("news.txt");
        • 1. Re: LoadVars
          kglad Adobe Community Professional & MVP
          what do you see in the output panel if you replace your code on the 60th frame with:
          • 2. Re: LoadVars
            hushhurt Level 1
            i get this in the output panel:

            _level0.myText :: this is test text information for the loadvars function.

            which "this is test text information for the loadvars function." is what i typed in my text file, but it still does not display in the text field.

            any ideas?
            • 3. Re: LoadVars
              guowy
              When you mean when you name your dynamic text field "myText". Because if that's the variable name it won't work. I hope you've used that as the instance name of the textfield.
              • 4. Re: LoadVars
                hushhurt Level 1
                correct.

                myText is the instance name of my text field.

                and my text file is named "news.swf" and inside i typed: info=this is test text information for the loadvars function.

                hope that helps.
                • 5. Re: LoadVars
                  hushhurt Level 1
                  now here is the WTF part.

                  just to test I created a new flash file and saved to to my desktop, then I created a new text file and saved it to my desktop - i placed all the code from the old flash file into the new one - and it works.

                  the only difference between the flash files, is that the new ones are saved to the desktop and not into folders.

                  is this a bug in flash?
                  • 6. Re: LoadVars
                    kglad Adobe Community Professional & MVP
                    no bug. are you doing something that requires your textfield's font to be embedded? for example, is your textfield masked?
                    • 7. Re: LoadVars
                      hushhurt Level 1
                      oh man... i feel silly.

                      i created an outline box over my text box will a fill, once i erased that, low and behold there was my text - thanks for all the help.

                      i will go stand in the corner now.
                      • 8. Re: LoadVars
                        kglad Adobe Community Professional & MVP
                        you're welcome.