Hi all,
I have a been developing an chat website using PHP,Mysql and flash. I have implemented everything.
I don't know much about AJAX My requirement is to devise a way of updating (in real-time) the current userlist and on clicking on the button it pass one user to flash at random so thay can chat withother.
Does anyone know of a method or technique to achieve a similar functionality? ANY help is much appreciated!
here is the code which is used to get userlist form database and javascript which will pass the one user.
<?php
if ($Member=='Member')
{
$i=0;
while ($i < $num)
{
$f1=mysql_result($result,$i,"MemberUserName");
//echo $f1;
?>
<a href="#" onclick="setCurrentUser('<?php echo $f1; ?>');"><?php if ($f1==$user) {} else {echo $f1;} ?></a><br/>
<?php
$i++;
}
and here is the JavaScript
function flashGetHref() { return location.href; }
function flashPutHref(href) { location.href = href; }
function flashGetTitle() { return document.title; }
function flashPutTitle(title) { document.title = title; }
var isMovieLoaded = false;
function MovieLoaded()
{
alert("movie loaded....!");
isMoiveLoaded = true;
}
function setCurrentUser (userName)
{
if (isMoiveLoaded = true)
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
alert("Welcome");
document.getElementById('chatApp').SendUserName(userName);
}
else
{
document.chatApp.SendUserName(userName);
//alert ("let the flash content load firt please");
}
}
else
{
alert ("let the flash content load firt please");
}
}
i just need to update userlist auto after 15 seconds and random user can be selected .
Thanks,
hotice47