Hi,
I did a tutorial on how to connect a Flash Dynamic text box to a MySQL database. I created a PHP file which connects to the database and displays fine. The tricky part has been getting Flash to display the results in the PHP file. Here is my AS code. If anyone can see what I am doing wrong can you help please. Much appreciated.
//function to load external data using the loadVars() object
//l=name of loadVars object
//n=name of text field
//t=trigger to decide whether to show all entries or just one.
//e= entry number to display (number)
//f=file to load from (string)
function lv(l, n, t, e, f) {
sb.setSize(null, 200);
sb2.setSize(null, 50);
//create a new loadVars object if one doesn't already exist if it does, use it
if (l == undefined) {
l = new LoadVars();
l.onLoad = function() {
var i;
//clear out any text that might already be there
n.htmlText = "";
//to show a single entry at a time we use the following code
if (t == undefined) {
n.htmlText += "<b>"+this["date"+e]+" - "+this["location"+e]+"</b><br><br>";
n.htmlText += this["comment"+e];
} else {
//cycle through and show all entries
for (i=0; i<this.n; i++) {
n.txt.htmlText += "<u><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"+this["date"+i]+" - "+this["location"+i]+"</a></u><br>";
}
}
sb.update();
sb2.update();
};
}
l.load(f);
function loadArc(passed) {
arcNum = passed-1;
lv(entries_lv, entries_txt, undefined, arcNum, "../php/shows-query.php");
//for the large entry textfield
lv(entries_lv, entries_txt, undefined, 0, "../php/shows-query.php");
//for the archives text field
lv(archive_lv, archive_txt, "cycle", null, "../php/shows-query.php");
}
}
Thank you
Kay