Zurück   Flashforum > Flash und Server > PHP und MySQL

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 12-08-2010, 13:32   #1 (permalink)
Armandosladen
Gast
 
Beiträge: n/a
Probleme Flash und PHP-Mysql

Hallo habe bei meinem Projekt folgendes Problem,
möchte gerne über PHP-mysql eine Playliste erstellen, die mein Player abspielen soll, klappt leider nicht, kann mir da einer weiter helfen, mir sagen wo mein Problem ist und mir helfen das es klappt

meine PHP "player.php"
PHP-Code:
<?php
include("dbase.php");

$result=mysql_query("SELECT * FROM `music_users` WHERE user='$username'");


header("content-type:text/xml;charset=utf-8");
echo 
"<playlist version=\"1\" encoding=\"UTF-8\">\n";
echo 
"<player showDisplay=\"yes\" showPlaylist=\"yes\" autoStart=\"yes\">\n";


while(
$row mysql_fetch_row($result)) {

echo
"<song path=\"$username/$row[3]\" title=\"$row[2]\" >\n";
}
echo 
"</player>\n";
?>

hier der code fürs Flash
Code:
_root.playlist == undefined ? playlist = "player.php" : playlist=_root.playlist;

//--------------------------------------------------------------------------

// stage variables
Stage.showMenu = false;
Stage.scaleMode = "noScale";
stop();

// player variables
volume = 90;
current_song = 1;
equalizer._visible=0;

// playlist loading
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);


// parsing all xml data into flash
function loadData(success) {
	if (success) {
		// showdisplay and playlist toggles
		showDisplay = this.firstChild.attributes.showDisplay;
		if (showDisplay == "yes") {
			top.easeY(toppos);
			topup = false;
			display_btn._rotation+=180; }
		showPlaylist = this.firstChild.attributes.showPlaylist;
		if (showPlaylist == "yes") {
			bot.easeY(botpos);
			botup = false;
			list_btn._rotation+=180; }
		// getting all titles and filenames
		aPath = new Array();
		songTitel = new Array();
		audioTracks = new Array();
		audioTracks.shuffle();
		audioTracks = this.firstChild.childNodes;
		song_total = audioTracks.length;		
		for (var i = 0; i<song_total; i++) {
			aPath.push(audioTracks[i].attributes.path);
			songTitel.push(audioTracks[i].attributes.title);
			// buiding playlist buttons
			bot.playlist.btn.duplicateMovieClip("btn"+i, i);
			bot.playlist["btn"+i]._y = bot.playlist.btn._y+i*int(bot.playlist.btn._height) +i;
			bot.playlist["btn"+i].txt = checkDigits(i+1)+". "+songTitel[i];
			bot.playlist["btn"+i].hit.onPress = function() {
				listClick(this._parent.getDepth()+1); }; 
		}
		//checking autostart mode
		autoStart = this.firstChild.attributes.autoStart;
		if (autoStart == "yes") {
			playSong(); 
			play_btn._visible = 0;
		} else if (autoStart == "no") {
			play_btn._visible = 1;
			pause_btn._visible = 0;
		} else if (autoStart == "random") {
			current_song = random(song_total)+1;
			playSong(); 
			play_btn._visible = 0;
		} else {
			current_song = int(this.firstChild.attributes.autoStart);
			playSong(); 
			play_btn._visible = 0; } }
	// done ! all loaded succesfully. purging trash
	delete audioTracks;
	delete data_xml;}

// list button
function listClick(prm) {
	delete pausepos;
	current_song = prm;
	MySound.stop();
	playSong(); }
	
// list scroller
bot.list_bg.onEnterFrame = function() {
	if (hitTest( _root._xmouse, _root._ymouse, true) && this._parent.playlist._height > this._height ) {
		ymin = this._y+this._height - this._parent.playlist._height;
		ymax = this._y+3;
		conv = (this._ymouse -15)*1.3/this._height;
		conv > 1 ? conv = 1 : null;
		conv < 0 ? conv = 0 : null;
		this._parent.playlist.easeY (ymax - conv*(ymax-ymin)); } }; 
bot.playlist.setMask(bot.list_bg);


// play function
function playSong() {
	AudioPath = aPath[current_song-1];
	// checking for pause > start from there
	if (pausePos>0) {
		equalizer._visible = 1;
		MySound.start(pausePos, 0);
		pausePos = 0;
	// startup new sound
	} else {
		MySound = new Sound();
		MySound.setVolume(volume);
		MySound.loadSound(AudioPath, true);
		MySound.onSoundComplete = function() {
			equalizer._visible = 0;
			if (autoStart == "random") {
				current_song = random(song_total)+1;
			} else {
				current_song == song_total ? current_song = 1 : current_song++;
			}
			playSong(); };
		// check loading bar
		track_load.onEnterFrame = function() {
			total = this._parent.MySound.getBytesTotal();
			geladen = this._parent.MySound.getBytesLoaded();
			if (geladen != total) {
				this._parent.load_display = Math.round((geladen*100/total))+"% Loaded";
				this._xscale = Math.round((geladen*100/total));
			} else {
				this._xscale = 100;
				equalizer._visible = 1;
				delete this.onEnterFrame;
				delete this._parent.load_display; } }; }
	// switch paly/pause buttons
	play_btn._visible = 0;
	pause_btn._visible = 1; }
	
	
// play button
play_btn.onRelease = function() {
	playSong(); };
	
	
// pause button
pause_btn.onRelease = function() {
	this._visible = 0;
	play_btn._visible = 1;
	pausePos = MySound.position/1000;
	MySound.stop();
	equalizer._visible=0;  };
	
	
// next button
next_btn.onRelease = function() {
	delete pausepos;
	current_song == song_total ? current_song = 1: current_song++;
	MySound.stop();
	playSong(); };
	
	
// previous button
prev_btn.onRelease = function() {
	delete pausepos;
	current_song == 1 ? current_song = song_total: current_song--;
	MySound.stop();
	playSong(); };

	
// display toggle button
top.setMask(top_mask);
toppos = top._y;
top._y = int(toppos + top_mask._height - 29);
topup = true;

display_btn.onPress = function() {
	if(topup == true) {
		top.easeY(toppos);
		topup = false; }
	else {
		top.easeY(int(toppos + top_mask._height -27));
		topup = true; }
	this._rotation += 180; };
		
// playlist toggle button

bot.setMask(bot_mask);
botpos = bot._y;
bot._y = botpos - bot.list_bg._height -6;
botup = true;

list_btn.onPress = function() {
	if(botup == true) {
		bot.easeY(botpos);
		botup = false; }
	else {
		bot.easeY(botpos - bot.list_bg._height -6);
		botup = true; }
	this._rotation += 180; };
		
// drag button functionality
drag_btn.onPress = function() {
	startDrag(this._parent); };
drag_btn.onRelease = drag_btn.onReleaseOutside=function () {
	stopDrag(); };

// updating time display 
this.onEnterFrame = function() {
	dur = int(MySound.duration/1000);
	pos = int(MySound.position/1000);
	playTime = {};
	playTime.minutes = int((pos)/60);
	playTime.seconds = int((pos)%60);
	playTime.total = checkDigits(playTime.minutes)+":"+checkDigits(playTime.seconds);
	trackTime = {};
	trackTime.minutes = int(dur/60);
	trackTime.seconds = int(dur%60);
	trackTime.total = checkDigits(trackTime.minutes)+":"+checkDigits(trackTime.seconds);
	if (load_display == undefined) {
		display = playTime.total+" / "+trackTime.total;
	} else {
		display = load_display; }
	if (trackDrag != true) {
		prozent = pos*100/dur;
		track_play._xscale = prozent; } };

// prefixing a 0 to the time
function checkDigits(toCheck) {
	return (toCheck<10) ? toCheck="0"+toCheck : toCheck; }
	
	
// track progress slider functions
track_back.onPress = function() {
	trackDrag = true;
	track_play.onEnterFrame = function() {
		perc = (this._parent._xmouse-this._parent.track_back._x)/this._parent.track_back._width;
		max = this._parent.track_load._width/this._parent.track_back._width;
		perc > max ? perc = max: null;
		perc < 0.01 ? perc = 0.01: null;
		this._width = this._parent.track_back._width*perc;
		pausePos = (perc*MySound.duration/1000); }; };
track_back.onRelease = track_back.onReleaseOutside = function () {
	delete track_play.onEnterFrame;
	trackDrag = false;
	MySound.stop();
	playSong(); };

	
// volume slider functions
vol_back.onPress = function() {
	vol_front.onEnterFrame = function() {
		perc = (_xmouse-vol_back._x)/vol_back._width;
		perc > 0.95 ? perc = 1: null; 
		perc < 0.05 ? perc = 0: null; 
		this._width = vol_back._width*perc;
		volume = Math.round(perc*100);
		MySound.setVolume(volume);
		equalizer._yscale = volume; }; };
vol_back.onRelease = vol_back.onReleaseOutside=function () {
	delete vol_front.onEnterFrame; };
vol_front.setMask(vol_mask);

// drawing equalizer in actionscript
equalizer.setMask(eq_mask);
equalizer.onEnterFrame = function() {
	i++;
	this.createEmptyMovieClip("graph"+i, i);
	with(this["graph"+i]) {
		_x = 0;
		_y = 0;
	    beginFill(0x666666, 50);
		moveTo(0,0);
		for (j=0; j< 36; j++) {
			z = random(12)+8;
			lineTo(j*6,-1);
			lineTo(j*6,-z);
			lineTo(j*6+4,-z);
			lineTo(j*6+4,-1);
			lineTo(j*6,-1); }
		lineTo(j*6,0);
		lineTo(0,0);
		endFill(); }
	i >= 3 ? i=0: null; };

	
// scrolling the display song title
function scrollTitle() {
	title.txt.autoSize = true;
	if (songTitel[current_song-1].length > 20) {
		title.txt.text = songTitel[current_song-1]+"     "+songTitel[current_song-1];
		title._x+title._width/2 +4< title_mask._x ? title._x = title_mask._x : title._x--; } 
	else {
		title.txt.text = songTitel[current_song-1];
		title._x = title_mask._x-3; } }
title.setMask(title_mask);
setInterval(scrollTitle, 40);


// easing display and playlist movement
MovieClip.prototype.easeY = function(t) {
	this.onEnterFrame = function() {
		this._y = int(t-(t-this._y)/1.5);
		if (this._y>t-1 && this._y<t+1) {
			delete this.onEnterFrame; } }; };
verstehe nicht warum es nicht funktioniert, wenn ich die php einzel aufrufe sieht sie aus wie die xml datei, wenn ich eine xml datei und den namen nehme dann klappt es.
Wenn 1000 User da wären, kann ich ja nicht 1000 xml dateien schreiben, es muß doch ne möglichkeit geben.
Kenne mich leider zu wenig aus mit flash, habe dieses zusammengewürfelt, bitte helft mir.

Vielen Dank im vorraus
  Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Probleme mit Login + Mysql Domenico Flash 8 6 09-07-2007 10:00
mysql-amfphp-flash, probleme mit umlauten oresde Flash Remoting 2 05-04-2006 17:33
Flash mySql Probleme mit LoadVars wesulaner PHP und MySQL 4 01-06-2005 10:30
mysql connection probleme motschi PHP und MySQL 1 26-08-2004 03:16
probleme mit id in mysql-db Dennis PHP und MySQL 13 27-04-2003 12:48


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:27 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele