Probleme Flash und PHP-Mysql

A

Armando

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:
<?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
 
Habe keinen Server, probiere das über Xampp- Apache und mysql , früher hatte ich Server, eine Fehlermeldung bekomme ich nicht, denke mal der Player erkennt das nicht.

Wenn ich eine hätte könnte ich weiter suchen, woran es liegt, aber leider hab ich keine. Würde dann googlen um mir weiter zu helfen.

Danke schonmal im vorraus
 
Zuletzt bearbeitet von einem Moderator:
Xampp ist auch ein Webserver, nämlich Apache ;-)

Schau mal in das xampp-Installations-Verzeichnis, da müsste es einen Ordner apache oder apache2 geben. In dem ist ein Ordner logs. Da drinnen speichert der Apache sein Error-Log. Schau da mal rein, nachdem du auf das HTML-File zugegriffen hast, was dein Flash-Object enthält.
 
[Thu Aug 12 14:06:14 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Thu Aug 12 14:06:14 2010] [notice] Child 3756: Exit event signaled. Child process is ending.
[Thu Aug 12 14:06:15 2010] [notice] Child 3756: Released the start mutex
[Thu Aug 12 14:06:16 2010] [notice] Child 3756: All worker threads have exited.
[Thu Aug 12 14:06:16 2010] [notice] Child 3756: Child process is exiting
[Thu Aug 12 14:06:16 2010] [notice] Parent: Child process exited successfully.

damit kann ich nix anfangen
 
[26/Jul/2010:08:46:16 +0200] "GET /phpmyadmin/themes/original/img/b_bookmark.png HTTP/1.1" 304 - "http://localhost/phpmyadmin/tbl_replace.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"


Da steht nirgends was brauchbares für mich drin. Sorry wenn ich nicht weiter helfen kann mit meinen angaben
 
Zuletzt bearbeitet von einem Moderator:
Also wenn im ersten (error-log) nicht mehr drin steht, als das, was du gezeigt hast, läuft dein Apache grade nicht. Das erklärt, warum dein Flash nicht auf das PHP-Script zugreifen kann.

Aber ich frage mich grad, wann und wie du das PHP-Script getestet hast. Hast du eine HTML-Datei oder auch PHP-Script, in der das Flash-Filmchen eingebettet ist? Liegt dieses HTML-File/PHP-Script zusammen mit dem Flash-Film im gleichen Ordner, wie das PHP-Script für die XML-Ausgabe? Klär mal auf, was du genau gemacht hast.

Ich denke nicht, das es ein Fehler im Script ist, wenn der XML-Output funktioniert. Ich denke auch nicht, das dein Flash einen Fehler hat. Ich glaube, du wendest das falsch an.
 
Arbeiten tue ich mit einem php editor, der server läuft und die mysql-datenbank auch, das weis ich, weil ich mich einloggen muß,
(if (!isset($_COOKIE["id"]) || $_COOKIE['usertype']!="chatusers" ){)
und xampp sagt auch aktiviert

habe einen ordner mp3 für verschiedene user
mp3- User1
- User2
usw
in dem ordner mp3 habe ich auch den player
und die player.php

wenn ich hier die xml reinmache klappt das ( mp3.xml)
die sieht so aus
<?xml version="1.0" encoding="UTF-8"?>
<player showDisplay="yes" showPlaylist="yes" autoStart="yes">
<song path="User1/123456.mp3" title="Bernhard Brink - lieder an die liebe" />

</player>

Der letzte Error-Log
[Thu Aug 12 20:40:47 2010] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 12 20:40:47 2010] [notice] Digest: done
[Thu Aug 12 20:40:49 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu Aug 12 20:40:49 2010] [notice] Server built: Nov 11 2009 14:29:03
[Thu Aug 12 20:40:49 2010] [notice] Parent: Created child process 3508
[Thu Aug 12 20:40:52 2010] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 12 20:40:52 2010] [notice] Digest: done
[Thu Aug 12 20:40:53 2010] [notice] Child 3508: Child process is running
[Thu Aug 12 20:40:54 2010] [notice] Child 3508: Acquired the start mutex.
[Thu Aug 12 20:40:54 2010] [notice] Child 3508: Starting 150 worker threads.
[Thu Aug 12 20:40:54 2010] [notice] Child 3508: Starting thread to listen on port 443.
[Thu Aug 12 20:40:54 2010] [notice] Child 3508: Starting thread to listen on port 80.
 
Zuletzt bearbeitet von einem Moderator:
Zurück