I want to create a dynamic biography page that pulls in data
from an XML file for multiple biography's. Can anyone help me with
instruction on how to create an array that loads only one bio at a
time on the press of a button, and when the next button is pressed
it loads the next bio? Attached is the script and the XML.
My best suggestion for the xml would be to do a search on
xfactorstudio on the internet, download the classes and find a
tutorial. Those classes make it very easily to build the array that
you want. As for the rest of the script, I'd create a placeholder
variable to keep track of where you are in the array. When the user
clicks a button, just display the contents of the next element in
the array and increment your placeholder variable by one.
var bio:Array = new Array();
var nCurrentbio:Number = 0;
var owner = this;
tb.htmlText = bio[nCurrentbio];
You'll have to adapt this code, but that's the basic
principle. You'll probably want to add some logic in the
loadNextBio function to ensure that if it reaches the end of the
array, it starts back over at the beginning.