You'll need to do two different things.
First create the SWF to be able to call the variables
in ActionScript
//This would be on a movie clip, blank or otherwise
onClipEvent (load) {
// You'll need some time based variables
// to only check every thirty seconds
// I'd personally look at: getTimer()
var starttime = getTimer();
var looptime = 30*1000; // 30 seconds in milliseconds
var elapsedtime = 0;
// make sure and get your variable the first time
loadVariables("usersLoggedIn.php","this");
}
onClipEvent (enterFrame) {
// how much time has past
elapsedtime = getTimer() - starttime;
// Now check every 30 seconds
if (elapsed >= looptime) {
// then its is time to get thoose variables again
loadVariables("usersLoggedIn.php","this");
// we are starting over
// so we increase the time to elapse by 30 seconds
looptime = looptime+(30*1000);
}
}
When using loadVariables(URL, target)
target is a string indicating the path to the movie clip or document level that the variables will be used
a more PHPish way to define the loadVariables()
loadVariable(string URL, string target [, string method])
the optional method argument is only used when sending the variables before retieving them
the only values are the string literals "POST" or "GET"
Then you need to create the PHP page that will make the variables
// This would be the usersLoggedIn.php page
// Start by making your connection to MySQL
// Then output your variables so that Flash can grab them,
// ie- they need URL encoding
echo "$myFirstVariable" . '=' . "$myFirstValue";
echo '&';
echo "$mySecondVariable" . '=' . "$mySecondValue";
// all this could be generated through a loop
// and it should be
// Also, no need for any HTML tags, they'll just get in the way.
HTH,
If you want more info about Flash and PHP try Ultrashock.
It's a Flash community site (built w/ php), and most Flash people like PHP,
where most PHP people don't like Flash 🙂
Check under their back-end programming forum for help with PHP/MySQL.
There are of course exceptions to every rule 😃
(edited for clarification)