Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-02-2007, 12:32   #1 (permalink)
Neuer User
 
Registriert seit: Jan 2007
Ort: Aachen
Beiträge: 8
Arrow Flash / Xml Player | Problem mit Wiedergabe

Hi,
diesen mp3 Player habe ich gestern in einem anderen Forum gefunden.
Leider bleibt der Player still. Könnt Ihr mir bitte sagen wo der Fehler liegt?

die .fla und .xml befinden sich im Anhang

Code:
//init variables and playlist textbox
musicPlay = true;
//music plays on startup
songList = new Array();
//song list array
playListFile = "default";
//default playlist file
track = 1;
//start from first track
newSong = false;
//init newSong
playlistshow.text = playListFile+".xml";
//show name of loaded playlist file
//XML objext define
playList = new XML();
playList.ignoreWhite = true;
//when XML is loaded fully parse and set sound/functions
playList.onLoad = function(success) {
	if (!success) {
		playlistshow.text = "file not found";
		return;
	}
	n = playList.firstChild.childNodes;
	for (var s = 0; s<n.length; s++) {
		songList[s] = n[s].attributes.file;
	}
	playlistshow.text = playListFile+".xml";
	//music sound object definition
	holder.music = new Sound();
	holder.music.loadSound(songList[track-1], true);
	holder.music.onSoundComplete = function() {
		track += 1;
		if (track>songList.length) {
			track = 1;
		}
		newSong = true;
	};
	//volume slider code
	//onEnterFrame for the slider clip 
	slider.onEnterFrame = function() {
		vol = Math.round((slider._x-slidebar._x)/(slidebar._width/100));
		holder.music.setVolume(vol);
	};
	//slider drag function on button 
	slider.btn.onPress = function() {
		slider.startDrag(false, slidebar._x, slidebar._y, slidebar._x+slidebar._width, slidebar._y);
	};
	slider.btn.onRelease = function() {
		slider.stopDrag();
	};
};
playList.load(playListFile+".xml");
//load playlist xml file
//assign an enterFrame to the holder clip to check for time and change tracks
holder.onEnterFrame = function() {
	if (musicPlay) {
		//convert track times in mins/seconds 
		pos = Math.round(holder.music.position);
		dur = Math.round(holder.music.duration);
		mins_played = Math.floor((pos/1000)/60);
		secs_played = Math.round(pos/1000)-(mins_played*60);
		mins_tot = Math.floor((dur/1000)/60);
		secs_tot = Math.round(dur/1000)-(mins_tot*60);
		if (pos != 0 && dur != 0) {
			if (secs_played>59) {
				mins_played += 1;
			}
			if (secs_tot>59) {
				mins_tot += 1;
			}
			if (secs_tot>59) {
				secs_tot = 0;
			}
			if (secs_played>59) {
				secs_played = 0;
			}
			if (secs_tot<10) {
				secs_tot = "0"+secs_tot;
			}
			if (secs_played<10) {
				secs_played = "0"+secs_played;
			}
			if (mins_played<10) {
				mins_played = "0"+mins_played;
			}
			if (mins_tot<10) {
				mins_tot = "0"+mins_tot;
			}
			progress.text = mins_played+":"+secs_played+" / "+mins_tot+":"+secs_tot;
		} else if (pos == 0 && dur == 0) {
			progress.text = "00:00 / 00:00";
		}
	} else if (!musicPlay) {
		progress.text = "00:00 / 00:00";
	}
	//track change 
	if (newSong) {
		holder.music.stop();
		holder.music = new Sound();
		holder.music.loadSound(songList[track-1], true);
		holder.music.onSoundComplete = function() {
			track += 1;
			if (track>songList.length) {
				track = 1;
			}
			newSong = true;
		};
		newSong = false;
	}
	//set text fields 
	title.text = playList.firstChild.childNodes[track-1].attributes.title;
	artist.text = playList.firstChild.childNodes[track-1].attributes.artist;
	album.text = playList.firstChild.childNodes[track-1].attributes.album;
};
//stop, play, skip btn onRelease actions 
onbtn.onRelease = function() {
	track += 1;
	if (track>songList.length) {
		track = 1;
	}
	if (musicPlay) {
		newSong = true;
	}
};
onbtn.onReleaseOutside = function() {
	track += 1;
	if (track>songList.length) {
		track = 1;
	}
	if (musicPlay) {
		newSong = true;
	}
	skipon.gotoAndStop("up");
};
backbtn.onRelease = function() {
	track -= 1;
	if (track<1) {
		track = songList.length;
	}
	if (musicPlay) {
		newSong = true;
	}
};
backbtn.onReleaseOutside = function() {
	track -= 1;
	if (track<1) {
		track = songList.length;
	}
	if (musicPlay) {
		newSong = true;
	}
	skipback.gotoAndStop("up");
};
playbtn.onRelease = function() {
	if (!musicPlay) {
		holder.music = new Sound();
		holder.music.loadSound(songList[track-1], true);
		holder.music.onSoundComplete = function() {
			track += 1;
			if (track>songList.length) {
				track = 1;
			}
			newSong = true;
		};
		musicPlay = true;
	}
};
playbtn.onReleaseOutside = function() {
	if (!musicPlay) {
		holder.music = new Sound();
		holder.music.loadSound(songList[track-1], true);
		holder.music.onSoundComplete = function() {
			track += 1;
			if (track>songList.length) {
				track = 1;
			}
			newSong = true;
		};
		musicPlay = true;
	}
	playclip.gotoAndStop("up");
};
stopbtn.onRelease = function() {
	if (musicPlay) {
		holder.music.stop();
		musicPlay = false;
	}
};
stopbtn.onReleaseOutside = function() {
	if (musicPlay) {
		holder.music.stop();
		musicPlay = false;
	}
	stopclip.gotoAndStop("up");
};
//stop, play and skip btn onRollOver/Out actions
onbtn.onRollOver = function() {
	skipon.gotoAndStop("down");
};
onbtn.onRollOut = function() {
	skipon.gotoAndStop("up");
};
backbtn.onRollOver = function() {
	skipback.gotoAndStop("down");
};
backbtn.onRollOut = function() {
	skipback.gotoAndStop("up");
};
playbtn.onRollOver = function() {
	playclip.gotoAndStop("down");
};
playbtn.onRollOut = function() {
	playclip.gotoAndStop("up");
};
stopbtn.onRollOver = function() {
	stopclip.gotoAndStop("down");
};
stopbtn.onRollOut = function() {
	stopclip.gotoAndStop("up");
};
ps: warum wird dieser Beitrag immer in AS1 verschoben ?
Angehängte Dateien
Dateityp: rar mp3player.rar (8,2 KB, 16x aufgerufen)

Geändert von 0llyver (16-02-2007 um 13:21 Uhr)
0llyver ist offline   Mit Zitat antworten
Alt 16-02-2007, 14:15   #2 (permalink)
Neuer User
 
Benutzerbild von _crypto_
 
Registriert seit: Mar 2006
Beiträge: 1.573
ersetz mal die onSoundComplete funktion durch
onLoad = function(success) funktion.

und es ist AS1 Syntax also ist es doch in AS1 wohl richtig
__________________

Currently working on:

- --- ---

-----------------------------------------------------------------
ActionScript 3.0, C++, Java, Delphi
_crypto_ ist offline   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



Alle Zeitangaben in WEZ +1. Es ist jetzt 12:44 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele