So far, I've managed to bring an entry into Flash from MySQL via PHP. here: http://www.andrewknapp.com/temp/flashnews/flashnews.swf
It is showing only one entry. Could anyone tell me how I would reformat what I have to make it alternate, in the same window, between Date and Message? Just like anyother news format. Here is the code I have thus far:
PHP:
FLASH:Code:<? include("common.php"); mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); $query = "SELECT * FROM tempernews ORDER BY id ASC"; $result = mysql_query($query) or die ("Error"); $num_rows = mysql_num_rows($result); for($i=0;$i<$num_rows;$i++){ $row = mysql_fetch_array($result); $news = "news$i"; $news = $row['message']; $date = "date$i"; $date = $row['date']; print("&news$i=$news"); print("&date$i=$date"); } ?>
Here's the Fla: http://www.andrewknapp.com/flashnews/flashnews.zipCode:System.useCodepage = true; format = new TextFormat(); testo.html = true; function formatText(textBox, ita, siz, Bold, colour) { format.italic = ita; format.size = siz; format.bold = Bold; format.font = "Arial"; format.align = "left"; format.color = colour; textBox.setTextFormat(format); } testo.text = "Loading news..."; formatText(testo, true, 10, true); date.text = "Loading..."; formatText(date, true, 10, true, "0xFF0000"); temp = new LoadVars(); temp.load("flashnews.php"); temp.onLoad = function() { myArray = new Array(); for (var a in this) { if (a != "onLoad") { myArray.push(this[a]); } } date.text = myArray[0]; formatText(date, false, 10, true, "0xFF0000"); testo.htmlText = myArray[1]; formatText(testo, true, 10, true); var oldt = getTimer(); var ok = true; var l = myArray.length; var i = 5; };




Reply With Quote