Wednesday, April 8, 2009

loading a text document to read as html in flash

function loadMe(){
//the loadVars object called my data has in it the variables created with text
//load the variables into the right text boxes
_root.title.html = true;
_root.title.text = myData.title;
_root.title.htmlText = myData.title;

//tell the textBox to use html formating
_root.textBox.html = true;
//bring the text in as html
_root.textBox.htmlText = myData.textBox;

}


function loadPageText(){
//create a new loadVars object to hold the new data
myData = new LoadVars();
//load the data into the new loadVars object
myData.load("text/events.txt");
myData.onLoad = function(success){
//check to see if the data has in fact loaded yet
if (success){
//pass the data in the form of its variables to text boxes. See below.
loadMe();
}else{
_root.textBox.text = "waiting...";
}
}
}

No comments:

Post a Comment