2 Replies Latest reply on Sep 24, 2009 6:48 PM by Ned Murphy

    use a text file as a database?

    shintashi

      Hi, I've got a bunch of quotes I want to stick into a text file and access through actionscript for a website (such as Spring quotes popping up when the clock is checked for what day it is).

       

      While I can stick one quote in one text file,

       

      I was wondering if there is a way to stick multiple quotes in one text file and pull them for display one at a time?

       

      Thanks.

        • 1. Re: use a text file as a database?
          Rothrock Level 5

          You can use a simple text file and LoadVars class.

           

          quote1=blah, blah, blah&

          &quote2=blahde, blah blah&

          &quote3=and so on.

           

          But a better way is probably to use XML, that way you can include formatting and do all kinds of other cool things with it.

          1 person found this helpful
          • 2. Re: use a text file as a database?
            Ned Murphy Adobe Community Professional & MVP

            As Rothrock mentions, using an XML file for your data is a better approach to using a text-based data file.  The tag-based format can make it easier to manage a varying number of data elements, where you can avoid things like numbering variables as the example Rothrock showed.  You should try searching Google for tutorials... use search terms like "AS2 XML tutorial"

            1 person found this helpful