7 Replies Latest reply on Jan 23, 2007 9:28 PM by abeall

    load var

    unknownewbie
      hi im pretty new with flash so i start a project which is a website and i have a dynamic text, and when people click buttons caleld like "news" or "downloads" the dynamic text will change according to a notepad file saved in the same folder as the fla/swf

      this is the script i have on my button and it isn't working =[ could anyone help?

      on (release) {
      var showtext:LoadVars = new LoadVars();
      text.load("news.txt");
      }
        • 1. Re: load var
          abeall Level 3
          on (release) {
          var showtext:LoadVars = new LoadVars();
          showText.load("news.txt");
          showText.onLoad = function(){
          someTextFieldWhichYouHaveNamed.text = this.someVariableWhichYouHaveDefinedInTheTxtFile;
          }
          }
          • 2. Re: load var
            unknownewbie Level 1
            ugh its not working =[

            my variable for the dynamic text is "showtext" my notepad file is "news.txt"
            • 3. Re: load var
              abeall Level 3
              Do you have a named TextField?
              • 4. Re: load var
                unknownewbie Level 1
                errrrrr no i only have a button, dynamic text field and a notepad file
                • 5. Re: load var
                  wesm9787
                  the dynamic text field would be the named text field then. you click on the dynamic text field, click on properties, and type in an instance name. then, link that named text field to each button correspondingly. like on the news button it would be news.text, for the downloads button it would be downloads.text, or whatever, and then i think what abeall is saying is in the actual notepad file you have to define the variable (like mydynamictext = news in the news.txt, mydynamictext = downloads for the downloads.txt, etc.). i could be wrong though. i'm just going by what i did when i made a text box for my game i'm making where the person playing puts in their name and it appears in a text box later.
                  • 6. Re: load var
                    unknownewbie Level 1
                    errr well k i have the instance as "InstanceName_5" and the variable of the property in the dynamic text as "showtext" and i have the file as "news.txt" could u show me the script =$ so i can learn the format?
                    • 7. Re: load var
                      abeall Level 3
                      "InstanceName_5"? How did you come up with that name? Anyway, maybe you would be better off just selecting the TextField, and for the Var field put "showText", then on the button use:

                      on(release){
                      loadVariablesNum("news.txt",0);
                      }