2 Replies Latest reply on Jul 19, 2006 1:44 PM by Newsgroup_User

    Using URL location from external file

    bobindy
      Hello,

      I have a button that opens a new browser window that uses a URL that may change from time to time. Simple question: how do I set up the URL to be read from an external file so it can be changed without having to edit the flash file?

      Thank you,
      Bob
        • 1. Re: Using URL location from external file
          Level 7


          bobindy wrote:
          > Hello,
          >
          > I have a button that opens a new browser window that uses a URL that may
          > change from time to time. Simple question: how do I set up the URL to be read
          > from an external file so it can be changed without having to edit the flash
          > file?
          >
          > Thank you,
          > Bob

          text file call url.txt, inside that file

          url_link=http://www.yourdomain.com/folder/file.html

          in flash on first timeline frame :

          loadVariablesNum("link.txt", 0);


          button action :

          on (release) {
          getURL(_level0.url_link, "_blank");
          }


          --
          Regards

          Urami


          --



          Happy New Year guys - all the best there is in the 2006 :)




          <urami>
          http://www.Flashfugitive.com
          </urami>

          <web junk free>
          http://www.firefox.com
          </web junk free>
          • 2. Re: Using URL location from external file
            Wolf_van_Ween Level 1
            You could use XML - it's universal, but also a bit complicated.
            I prefer a simple URL-encoded text file with loadVariables()
            The text file would be just one line like this:
            my_url=http%3A%2F%2Fwww.example.com
            After a loadVariables("my.txt","_root"); you have a _root variable called my_url
            As simple as that. The only thing you need to be aware of is that loading the file takes time, so the variable my_url will still be undefined for some time. But that isn't a problem if you only use it in a getURL later on, because the user will not click fast enough.
            If you want to avoid this and uncertainty about whether the text file was actually loaded correctly, use the LoadVars class. See help file.