Voetsjoeba
August 2nd, 2003, 08:32 AM
Hi,
I'm pulling data from a MySQL database into Flash (MX) through PHP.
In MySQL, I have a table in the database "max_voetsjoeba" called "news" in which there are three fields. A dummy value, "inhoud" and "datum".
This is the code for the PHP file (thanks Jubba ;)):
<?
$l = mysql_connect("localhost", "max_voetsjoeba","--hidden--");
mysql_select_db("max_voetsjoeba");
$q = "SELECT * FROM news";
$r = mysql_query($q, $l);
if($r){
$nrows = mysql_num_rows($r);
$output="";
for ($i=0; $i < $nrows; $i++){
$row = mysql_fetch_array($r);
$output .= "&i=".$i;
$output .= "&datum".$i."=".$row['datum'];
$output .= "&inhoud".$i."=".$row['inhoud'];
}
print $output;
}
else
{
print mysql_error($l);
}
mysql_close($l);
?>
This works fine, you can see the output of this PHP file here (http://voetsjoeba.asianillusion.com/news.php).
In Flash, I have:
onClipEvent (load) {
lv = new loadVars();
lv.onLoad = function(success) {
if (success) {
//this.i is the variable, i is a textfield
i = this.i;
inhoud = this.inhoud
img.loadMovie("http://users.pandora.be/voetsjoeba/eclipse.jpg");
} else {
trace("failed to load script");
}
};
lv.load("http://voetsjoeba.asianillusion.com/news.php");
}
(thanks Ahmed ;))
I can see the image file, but I can't see the text (inhoud). I took a look at the PHP file and changed "this.inhoud" to "this.inhoud0" (see the PHP file's output). This worked, but I wanted it to change automatically, so I tried "inhoud = this.inhoud+this.i" (i is 0, see PHP file's output). This doesn't work, instead of this.inhoud0 it becomes 0. Why ?
And how do I make the textfield scroll AND have it render as HTML ?
I'm pulling data from a MySQL database into Flash (MX) through PHP.
In MySQL, I have a table in the database "max_voetsjoeba" called "news" in which there are three fields. A dummy value, "inhoud" and "datum".
This is the code for the PHP file (thanks Jubba ;)):
<?
$l = mysql_connect("localhost", "max_voetsjoeba","--hidden--");
mysql_select_db("max_voetsjoeba");
$q = "SELECT * FROM news";
$r = mysql_query($q, $l);
if($r){
$nrows = mysql_num_rows($r);
$output="";
for ($i=0; $i < $nrows; $i++){
$row = mysql_fetch_array($r);
$output .= "&i=".$i;
$output .= "&datum".$i."=".$row['datum'];
$output .= "&inhoud".$i."=".$row['inhoud'];
}
print $output;
}
else
{
print mysql_error($l);
}
mysql_close($l);
?>
This works fine, you can see the output of this PHP file here (http://voetsjoeba.asianillusion.com/news.php).
In Flash, I have:
onClipEvent (load) {
lv = new loadVars();
lv.onLoad = function(success) {
if (success) {
//this.i is the variable, i is a textfield
i = this.i;
inhoud = this.inhoud
img.loadMovie("http://users.pandora.be/voetsjoeba/eclipse.jpg");
} else {
trace("failed to load script");
}
};
lv.load("http://voetsjoeba.asianillusion.com/news.php");
}
(thanks Ahmed ;))
I can see the image file, but I can't see the text (inhoud). I took a look at the PHP file and changed "this.inhoud" to "this.inhoud0" (see the PHP file's output). This worked, but I wanted it to change automatically, so I tried "inhoud = this.inhoud+this.i" (i is 0, see PHP file's output). This doesn't work, instead of this.inhoud0 it becomes 0. Why ?
And how do I make the textfield scroll AND have it render as HTML ?