Ok, I have successfully gotten my data into Flash (using a tutorial), but the results are in the wrong order...
In Flash I have two dyn. text fields which display the current news (entries_text) and previous news entries headers and dates (archive_txt). The problem is, the order of the displayed archives is correct, but the links to fill the "news_txt" are reversed.
This uses a feature in Flash wherein an "asfunction" is called within html code.
PHP ----------
<?php
mysql_pconnect ("208.179.130.30", "nballer_admin", "7s6q5L");
mysql_select_db ("nballer_mysql");
$qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC");
$nRows = mysql_num_rows($qResult);
$rString ="&n=".$nRows;
for ($i=0; $i< $nRows; $i++){
$row = mysql_fetch_array($qResult);
$rString .="&id".$i."=".$row['id']."&"."&title".$i."=".$row['title']."&"."&date".$i."=".$row['date']."&"."&entry".$i."=".$row['entry']."&";
}
echo $rString."&";
?>
ACTIONSCRIPT-----------
// 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["title"+e]+"<br>"+this["date"+e]+"</b><br>";
n.htmlText += this["entry"+e];
} else {
// cycle through and show all entries
for (i=0; i<this.n; i++) {
n.htmlText += "<b><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"+this["title"+i]+" - "+this["date"+i]+"</a></b><br><br>";
}
}
sb.update();
sb2.update();
};
}
l.load(f);
}
function loadArc(passed) {
arcNum = passed-1;
lv(blog_lv, entries_txt, undefined, arcNum, "news.php");
}
// for the large entry textfield
lv(blog_lv, entries_txt, undefined, 0, "news.php");
// for the archives text field
lv(archive_lv, archive_txt, "cycle", null, "news.php");
stop();