Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Randomly Selecting a record from a text area and showing it in swf?

Status
Not open for further replies.

jaslr

Programmer
Aug 16, 2001
67
AU
I am making a website in flash and one of the components on the homepage is "Artifact of the week" (is an historical site) .

So, instead of me manually changing the artifict image and words each week I would like to create a big txt file that includes: ArtifactImageURL field and ArtifactTxtInfo field (would be a paragraph or so) and make it into a record which is in an array. Then, everytime the page loads one record is randomly selected and displayed on the front page.

Any clues as to HOW to do this? should I be using a linked txt file to store the link to the image, and the information about the artifact OR should I be using xml? I'm puzzled.
 
XML is a much better way to go than a text file. however, the really "best" option would be a simple database (like mysql, for instance), where your "random choice" is simply picking a number from 1 to the number of images, and retrieving just that one row from the database (a simple SELECT...WHERE statement) and using that data.

However, the simplest option is to use XML since that ability is inherent in Flash. using a database like that would probably necessitate using some external scripting language like PHP to connect to the DB and feed the data to your Flash file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top