12 Replies Latest reply on Aug 21, 2006 11:35 AM by jla2w

    LoadVariablesNum

    jla2w
      I load a variable from a text document into a frame on my flash movie. It is the homepage of my web site. When you view the home page the first time it works. But if you then browse the other frames in my movie and come back to the hompage the text will show up, but the links are not active, and then, if you resize the explorer window, the text disappears. HELP?! I do not know why that is happening. I am relatively new to actionscript.
        • 1. Re: LoadVariablesNum
          Level 7
          jla2w,

          > But if you then browse the other frames in my movie and
          > come back to the hompage the text will show up, but the
          > links are not active, and then, if you resize the explorer
          > window, the text disappears. HELP?!

          Would you post the ActionScript you're using?

          > I do not know why that is happening.

          Ha! Neither do we. ;) Let's see your code.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: LoadVariablesNum
            jla2w Level 1
            this is the code in the layer for the frame where the text is loaded.

            loadVariablesNum("news.txt",0);

            • 3. Re: LoadVariablesNum
              jla2w Level 1
              if you would like to see the site... www.ifpress.com
              • 4. Re: LoadVariablesNum
                jla2w Level 1
                the dynamic text box is called

                _root.currentnews

                and the text file reads like this,

                _root.currentnews=
                <br><b>Fall 2006 Short Course: </br></b>
                <br></br>
                <br>November 6-10, 2006 </br>
                <br>The Greenbrier, White Sulphur Springs, WV </br>
                <br>Enrollment is limited*</br>
                <br></br>
                <br><b>2006 Student Award:</b></br>
                <br></br>
                <br>Application deadline: Dec 31, 2006 </br>
                <br>Please click on the link to learn more about the application process.</br>
                • 5. Re: LoadVariablesNum
                  abeall Level 3
                  I've never heard of using dot syntax in a .txt file that's loaded via loadVariables/loadVariablesNum. I'm fairly certain it has to be formatted like a query string:

                  currentnews=blah
                  &futurenews=bloo
                  &morenews=de blah

                  ect.

                  So in other words, try it without the _root. in the .txt file. Also, there's no point in loading something that's already loaded, so why not check first?

                  if(!currentnews)loadVariablesNum("news.txt",0);

                  Also, _root.currentnews='whatever' would not work in AS, because in order to change the text you must use _root.currentnews.text or _root.currentnews.htmlText. I'm assuming, though, that _root.currentnews is using the 'var' field as "currentnews" and that's how the text is being assigned?
                  • 6. Re: LoadVariablesNum
                    abeall Level 3
                    BTW, is this a templated or did you make it yourself?
                    • 7. Re: LoadVariablesNum
                      jla2w Level 1
                      It was a template, but I destroyed the template... I have to give credit that it was originally a template, but it looks nothing like it anymore. Thanks for the help, I will try a few of those things
                      • 8. Re: LoadVariablesNum
                        jla2w Level 1
                        _root.currentnews is the only way that I can get LoadVariablesNum to bring in the text file and put into my dynamic text field that uses the variable name _root.currentnews. If I take away the _root. LoadVariablesNum does not load the text.

                        I did add the IF statement that you recommended. Thank you.
                        • 9. Re: LoadVariablesNum
                          abeall Level 3
                          Did the if statement seem to have any affect?

                          I have no idea why using _root would work, based on what you've said it really shouldn't. At most, you should use _root here:

                          _root.loadVariablesNum("news.txt",0);

                          But the key thing that we don't know is how you are putting the loaded variable into the the textfield _root.currentnews? Perhaps when you said "the text box is called _root.currentnews" you did not mean that the TextField has an instance name of 'currentnews', but rather that the texfield has it's 'var' field set to currentnews?
                          • 10. Re: LoadVariablesNum
                            jla2w Level 1
                            Yes, the dynamic textfield's 'var' field is set to:

                            _root.currentnews

                            And the text does load with it set up like this, but it has the problems that I stated in the original post.

                            How would you have gone about loading this variable from a text field.
                            • 11. Re: LoadVariablesNum
                              abeall Level 3
                              To tell you the truth, I haven't used .txt for backend in a long time, I use XML. XML is a little more involved, and slower, but the organization is very nice and you can in some ways do more with it.

                              Is the TextField on the _root? If it is, then for it's var take of the '_root' reference, and likewise take off the _root reference in the loadVariablesNum. Then put on the _root:
                              if(!currentnews)loadVariablesNum("news.txt",0);

                              See what that does.
                              • 12. Re: LoadVariablesNum
                                jla2w Level 1
                                The text field is not on the _root, which is why I think that when I take the '_root' reference off the var field it does not work.

                                I could try what you are saying, but how do I put the textfield on the _root?