Reading from database.
you will need to use xml probably. you can format your database into xml and pass it directly to your flash file if you like without creating a static file…
Based on the question im guessing you are a smarty
eg: in flash
// text field properties
with (head_txt) {
html=true, wordWrap=true;
}
/*-------------------------------------------------------------------------
load XML
-------------------------------------------------------------------------*/
blog_xml = new XML();
blog_xml.ignoreWhite = true;
blog_xml.onLoad = function(success) {
if (success) {
head_txt.htmlText = "";
blog = this.firstChild.childNodes;
for (e=0; e<this.firstChild.childNodes.length; e++) {
my_author = blog[e].attributes.author;
my_date = blog[e].attributes.date;
my_blurb = blog[e].attributes.body;
my_head = "Some freak by the name of "+my_author+" wrote... ";
setText();
}
} else {
my_txt.text = "Error!";
}
};
head_txt.text = "Loading...";
blog_xml.load("xml-6.php");
/*-------------------------------------------------------------------------
display it
-------------------------------------------------------------------------*/
function setText() {
head_txt.htmlText += my_head+"<br>";
head_txt.htmlText += my_date+"<br><br>";
head_txt.htmlText += my_blurb+"<br><br>";
}
this is what xml-6.php looks like
<?php
$host = "localhost";
$user = "root";
$pass = "**********";
$database = "test";
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM articles ORDER BY id";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>
";
$xml_output .= "<entries>
";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "<entry";
$xml_output .= " author=\"" .$row['posted_by']. "\"";
$xml_output .= " date=\"" .$row['created_at']. "\"";
$row['body'] = str_replace("\"", "'", $row['body']);
$xml_output .= " body=\"" . $row['body'] . "\"";
$xml_output .= ">blah";
$xml_output .= "</entry>
";
}
$xml_output .= "</entries>";
//$xml_output = str_replace("&", "and", $xml_output);
//$xml_output = str_replace("\"", ""e", $xml_output);
print $xml_output;
?>
attached below is an sql dump you can put into your database for the testing the above code.
I would recommend using a duplicated or attached movieclip which contains both a text field and a movieclip.
you can load your image onto the clip with a link you supply via a row in your table. and the text from another row.
Hope this helps
:mario:
also place each next item based at the last items height + your spacing value
and place all of this info within a scroller (like kirupas one in source and experiments)
then for the buttons on the left… well someone else may answer that better
Reading from database.
I didnt think this was possible with mySQL. Sorry dont know how to do that. I always use text only.
looks like you understand what to do to me.
however check below this may help