You can “echo” any message back to Flash and display it in a dynamic textfield to let the user know the message was sent, just add “&status=” in front of your text,
as in “&status=Your message has been sent” :
LoadVars.onLoad =>assign returned var to the status_txt.text property by setting
status_txt.text=this.status; (where “this” refers to the LoadVars object you’re sending the PHP result to, either the same one you used to send your variables, or a separate resultVars = new LoadVars).
Read the above mentioned post and it cleared many things up for me. I’m new to the whole flash scene but have been working with PHP extensively for the last few months.
I still don’t understand how to get the php vars to Flash dynamic text. Here is a script I’m trying to display the information from!
<?
include("../conf.php");
include("../functions.php");
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT id, slug AS title, content, timestamp FROM services ORDER BY timestamp DESC LIMIT 0, 10";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print article titles
while($row = mysql_fetch_array($result))
{
$abrv = substr($row['content'], 0, 125);
echo '
<a href="story.php?id=', $row['id'] ,'">', $row['title'] ,'</a><br />
', $abrv ,'...<br /><br />';
}
}
else
{
echo 'No press releases currently available';
}
// close database connection
mysql_close($connection);
?>
If someone could show me the necessary Action Script I would be light years ahead of the game in understanding this process. Thanks and regards.