3 Replies Latest reply on Mar 10, 2007 1:23 PM by 2m

    using external files in flash

    mohsena
      Hello : as you know for Loading external text to a dynamic text field we use two following syntax:
      loadVarsText = new loadVars();
      loadVarsText.load("test.txt");
      Now I have to use variable in the() in the laod function instead of test.txt ,how can I use variable loadVarsText.oad()?
      I appreciate you .
      Mohsena
        • 1. Re: using external files in flash
          2m Level 2
          just write the name of your variable inside the parentheses ( () ) ;-) without the quotation marks ("").
          • 2. Re: using external files in flash
            mohsena Level 1
            Hello and thank you very much for your attention ,realy the following code shows what I want realy do
            on (release) {
            willieLoad = new LoadVars();
            willieLoad.onLoad = function() {
            _root.twoNuts.text = this.bill;
            };
            _global.findText=this._name;
            willieLoad.load(_global.findText.txt);

            }
            as you see ,I retrieve the name of instance of the movie clip ( which act a s button) and assing it to a global variable (_global.findText=this._name)then I want to load a text file which has the same name of the movie clip instance:willieLoad.load(_global.findText.txt) .I put the variable in paranthesis as you told me but it couldn't find the external text file and the error is :
            Error opening URL "file:///F|/ActionScriptPractice/ExternalFiles/"
            Please hlep me:
            I appreciate you :
            Sincerely yours Mohsena

            • 3. Re: using external files in flash
              2m Level 2
              the error your getting is due to the fact that "_global.findText.txt" is undefined - whereas "_global.findText" might not be. My guess is that what you want to do is loading a file with the same name as your clip, but with the extension ".txt", sou the loading line should be:
              willieLoad.load(_global.findText+".txt");

              regards

              M