Hi,
I am currently trying to add a music player to my social network website that allows users to upload their own tracks and play them through an mp3 player embedded in their profile page.
The problem i am having is that i want the mp3 player to read the track name, artist name, and the file location from the database.
I have written my PHP file to query the database but cant get the flash file to read the variables out.
I am foremost a designer and not the best programmer, so i was hoping someone could help as i have tried numerous tutorials and still cant quite get it.
The mp3 player works when loading the mp3 files from a URL, and the PHP file is pulling out the varaibles form the database succesfully, it has just hit problems when loading the variables from the database into the flash, i know it is the Actionscript but i cant work it out as yet....
My PHP code is:
<?php
require('../includes/adodb_setup.inc');
$id = $_GET['id'];
$sql = "SELECT * FROM person LEFT JOIN tracks ON person.person_musictrack = tracks.track_ID WHERE person.person_ID = '$id'";
$result = mysql_query($sql) or die("<b>error</b>: failed to execute query <i>$query</i>");
$desiredContent = mysql_fetch_array($result, MYSQL_ASSOC);
mysql_free_result($result);
//echo "$desiredContent[track_artist]";
print "filename=$desiredContent[track_filename]&artist=$desiredContent[track_artist]&track=$desiredContent[track_title]";
?>
And my Action Script is:
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("// once vars have been loaded, we will have these variables:
//----------------<sound initialization>----------------\\
var bgMusak:Sound;
bgMusak.setVolume(100);
this.trackInfo.autoSize = "left";
playMusak();
//----------------<sound setup>----------------\\
function pauseMusak(){
delete bgMusak;
};
function playMusak() {
bgMusak = new Sound();
bgMusak.loadSound(myVars.filename, true);
artistInfo.text = (myVars.artist);
trackInfo.text = (myVars.track);
bgMusak.onLoad = function(success) {
if (!success) {
trackInfo.text = "Failed to load track.";
}
};
};
Can anyone help me?
Thanks....
I am currently trying to add a music player to my social network website that allows users to upload their own tracks and play them through an mp3 player embedded in their profile page.
The problem i am having is that i want the mp3 player to read the track name, artist name, and the file location from the database.
I have written my PHP file to query the database but cant get the flash file to read the variables out.
I am foremost a designer and not the best programmer, so i was hoping someone could help as i have tried numerous tutorials and still cant quite get it.
The mp3 player works when loading the mp3 files from a URL, and the PHP file is pulling out the varaibles form the database succesfully, it has just hit problems when loading the variables from the database into the flash, i know it is the Actionscript but i cant work it out as yet....
My PHP code is:
<?php
require('../includes/adodb_setup.inc');
$id = $_GET['id'];
$sql = "SELECT * FROM person LEFT JOIN tracks ON person.person_musictrack = tracks.track_ID WHERE person.person_ID = '$id'";
$result = mysql_query($sql) or die("<b>error</b>: failed to execute query <i>$query</i>");
$desiredContent = mysql_fetch_array($result, MYSQL_ASSOC);
mysql_free_result($result);
//echo "$desiredContent[track_artist]";
print "filename=$desiredContent[track_filename]&artist=$desiredContent[track_artist]&track=$desiredContent[track_title]";
?>
And my Action Script is:
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("// once vars have been loaded, we will have these variables:
//----------------<sound initialization>----------------\\
var bgMusak:Sound;
bgMusak.setVolume(100);
this.trackInfo.autoSize = "left";
playMusak();
//----------------<sound setup>----------------\\
function pauseMusak(){
delete bgMusak;
};
function playMusak() {
bgMusak = new Sound();
bgMusak.loadSound(myVars.filename, true);
artistInfo.text = (myVars.artist);
trackInfo.text = (myVars.track);
bgMusak.onLoad = function(success) {
if (!success) {
trackInfo.text = "Failed to load track.";
}
};
};
Can anyone help me?
Thanks....