6 Replies Latest reply on Dec 21, 2007 5:18 PM by Twinbird24

    problem with .as files

    Twinbird24 Level 1
      Is it possible to load variables from an external .txt file into a .as (actionscript 2.0 class file) file? I have actionscript in an .as file that is compiled into an .swf that is going to be used to download files from my web sever. I want it so that the .as file load a variable from an external .txt file that determines the name of the file to be downloaded. How can I do this? Thanks.
        • 1. Re: problem with .as files
          dr_ross Level 1
          Look up LoadVars in the flash help, "LoadVars.load" has an example that will help you.
          • 2. Re: problem with .as files
            Twinbird24 Level 1
            I typed this into the .as file:

            public load("user1downloads.txt":String) : Boolean

            and in the Compiler Errors panel it says:

            A member attribute was used incorrectly
            public load("user1downloads.txt":String) : Boolean

            I still don't get how to do this. I have a LoadVars object on _level5 (loaded into level 5 by another .swf on level0). Is there I way to use that in .as file?
            • 3. Re: problem with .as files
              dr_ross Level 1
              oh yeah thats not going to work, i'm guessing you didn't write this .as class file.

              It looks like you're trying to directly input the value of a parameter into the function declaration which is why flash is complaining about it.

              What you need to do is find where you're declaring the instance of this class and call the load function on it from there passing in the textfile link.

              so if your as file is called MyLoaderClass.as then you need to look for where this class is declared and call the load function from that.

              var myLoader = new MyLoaderClass();

              and then in that load function in the MyLoaderClass is where you should be using LoadVars.load() passing the parameter in.

              If you're still confused you might have to post your fla and as file for more accurate help.
              • 4. Re: problem with .as files
                Twinbird24 Level 1
                Thanks for your feedback but I'm not really getting it.

                index.swf (_level0)
                zvp.swf (_level5) //loaded by MovieClipLoading on _level0

                All I'm trying to do is make Flash download files. In zvp.swf there are 5 text files that load the name of the file on the server. The names of the files are in an external .txt file. There is a download button beside each text box. I want it so that when you click on the right button, it's downloads the file that is associated with it (the file that is show in the text box next to it. I know it sound kinda confusing. Visit the website I'm working on at www.zoli.com , click on Login and use the Username: dr_ross and the Password: 24 to look at the downloads page. Thanks alot for helping. The names of all the files should be test.txt.

                actions in .as file:
                • 5. Re: problem with .as files
                  Twinbird24 Level 1
                  yeah and i downloaded the file from here: http://www.tink.ws/a_round_trip_with_filereference/webdu.html

                  anywayz it's almost xmas and no skool, ganna have some halo 3 lan at ma house. getting a new pc for xmas too, a quad core w/ 4 gigs a ram XD
                  • 6. Re: problem with .as files
                    Twinbird24 Level 1
                    Never mind, I got it figured out!! I'm so happy. Thanks for your help!