mrcandu2
asked on
Flash mp3 Player / php track page / Javascript integration
Hi there.
I currently have a php page that querys a database then lists information on 10 mp3s. Also on the page is an flash mp3 player that plays each of the mp3s listed on the page in turn. The information on the mp3's is loaded into the mp3 player using flashvars, turned into an array, so when each track finishes playing a new one is loaded.
What I would like to do is when an mp3 track is playing in the mp3player, that track is hightlighed in the php page in some other text colour. The idea of using javascript is so I do not have to refresh the page. Is this possible to achieve with javascript?
If I am barking up the wrong tree, please let me know. Any help is much appreciated.
Just to add, I know nothing about javascript other than it runs client side.
Many Thanks,
Mr Candu
I currently have a php page that querys a database then lists information on 10 mp3s. Also on the page is an flash mp3 player that plays each of the mp3s listed on the page in turn. The information on the mp3's is loaded into the mp3 player using flashvars, turned into an array, so when each track finishes playing a new one is loaded.
What I would like to do is when an mp3 track is playing in the mp3player, that track is hightlighed in the php page in some other text colour. The idea of using javascript is so I do not have to refresh the page. Is this possible to achieve with javascript?
If I am barking up the wrong tree, please let me know. Any help is much appreciated.
Just to add, I know nothing about javascript other than it runs client side.
Many Thanks,
Mr Candu
What you are searching for is the getURL() method in Flash:
getURL("javascript:highLig ht('rowID' );")
If you have problems writing the highLight() JavaScript function, then post the page html source here.
getURL("javascript:highLig
If you have problems writing the highLight() JavaScript function, then post the page html source here.
ASKER
Many thanks geordie007 & Zvonko for your help, I am away from my computer at the momment, but will be sure to try out your suggestions when I am home. I will keep you posted on how it goes.
Many Thanks,
Mr Candu
Many Thanks,
Mr Candu
ASKER
Ok...... Yes I am having problems writing the javascript function. I have posted some basic code below that we can work on for this example. So what I need is to add the function that will change a row id's text colour when told to by the flash mp3 player using the command: getURL("javascript:highLig ht('rowID' );")
Many thanks in advance.
Mr Candu.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width=400 cellspacing=0 cellpadding=0 border=0>
<tr id="trackID1">
<td width=50> <a href="page?play=trackID1"> 1</a></td>
<td width=250><a href="page?play=trackID1"> Track Name 1</a></td>
<td width=100><a href="page?play=trackID1"> Track Genre 1</a></td></tr>
<tr id="trackID2">
<td width=50> <a href="page?play=trackID2"> 2</a></td>
<td width=250><a href="page?play=trackID2"> Track Name 2</a></td>
<td width=100><a href="page?play=trackID2"> Track Genre 2</a></td></tr>
<tr id="trackID3">
<td width=50> <a href="page?play=trackID3"> 3</a></td>
<td width=250><a href="page?play=trackID3"> Track Name 3</a></td>
<td width=100><a href="page?play=trackID3"> Track Genre 3</a></td></tr>
<tr id="trackID4">
<td width=50> <a href="page?play=trackID4"> 4</a></td>
<td width=250><a href="page?play=trackID4"> Track Name 3</a></td>
<td width=100><a href="page?play=trackID4"> Track Genre 3</a></td></tr>
</table>
</body>
</html>
Many thanks in advance.
Mr Candu.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width=400 cellspacing=0 cellpadding=0 border=0>
<tr id="trackID1">
<td width=50> <a href="page?play=trackID1">
<td width=250><a href="page?play=trackID1">
<td width=100><a href="page?play=trackID1">
<tr id="trackID2">
<td width=50> <a href="page?play=trackID2">
<td width=250><a href="page?play=trackID2">
<td width=100><a href="page?play=trackID2">
<tr id="trackID3">
<td width=50> <a href="page?play=trackID3">
<td width=250><a href="page?play=trackID3">
<td width=100><a href="page?play=trackID3">
<tr id="trackID4">
<td width=50> <a href="page?play=trackID4">
<td width=250><a href="page?play=trackID4">
<td width=100><a href="page?play=trackID4">
</table>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well thats just amazing,......... it worked first time in IE and firefox.
Thanks Very Much.
Thanks Very Much.
:-)
i don't think you're barking up the wrong tree, unfortunately i don't know enough about flash to comfirm that! is it possible for flash to call a javascript function that resides on the same page as the flash movie? if so, the theory would be this...
as you loop over your php/mysql recordset you include an id on each of the mp3 links. as the flash pays a track, it would call a javascript function on the page, passing the flashvar of the track as a parameter (for example changeTrack('crazy.mp3')).
document.getElementById('c
as you use your php to write the tracks out, you could also populate a javascript array to contain all the track id's. in this way, the changeTrack function would first look through all of the id's, making sure they're all *not* highlighted, and then highlight the track passed as the parameter/argument.
hope this is some help to you - sorry i don't know enough about flash to be a bit more specific.