speedy6n2
Threadersteller
Dabei seit: 14.11.2008
Ort: Friedberg
Alter: -
Geschlecht:
|
Verfasst Fr 31.07.2009 13:58
Titel Flash MP3 Player |
|
|
Hey Ich habe ein kleines Problem und zwar soll ich einen Mp3 Player für Flash so anpassen das das erste Lied was aus der XML Datei geladen wird sofort anfängt und gegebenenfalls auch auf das 2 Lied von alleine Springt (dies ist aber kein muss), sitze jetzt schon eine ganze weile an dem Code nur komme zu keinem Ergebniss. Was müsste ich an dem Code Ändern?
// XML (Playlist + Arrayverwaltung)
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = ladeDaten;
data_xml.load(playlist);
function ladeDaten(success) {
if (success) {
aPath = new Array();
songTitel = new Array();
songArtist = new Array();
songCover = new Array();
audioTracks = new Array();
audioTracks = this.firstChild.childNodes;
totalAudio = audioTracks.length;
for (var i=0; i<totalAudio; i++) {
if (audioTracks[i].nodeName == "song") {
aPath.push(audioTracks[i].attributes.path);
songTitel.push(audioTracks[i].attributes.title);
songArtist.push(audioTracks[i].attributes.artist);
songCover.push(audioTracks[i].attributes.bild);
}
}
AudioPath = aPath[0];
titel = songTitel[0];
artist = songArtist[0];
aktAudio = 0;
trackAnzeige = aktAudio+" / "+totalAudio;
status = "Status: playlist - Loaded";
if (playerlook) setCover(0);
erstesBild = true;
} else {
status = "Status: PlayList - Not loaded";
}
delete audioTracks;
delete data_xml;
}
// Lautstärke und Balance Ausgangswerte
volume = 100;
balance = 0;
// Playschalter
play_btn.onRelease = function() {
if (pauseSignal == true) {
MySound.start(pausePos, 0);
pauseSignal = false;
playSignal = true;
delete pausePos;
kugel_mc._visible = 1;
} else {
MySound = new Sound();
if (volstatus < volume) {
volume = volstatus;
} else if (volstatus > volume) {
volume = volstatus;
} else if (volstatus == 100) {
volume = 100;
}
if (balstatus < balance) {
balance = balstatus;
} else if (balstatus > balance) {
balance = balstatus;
} else if (balstatus == 0) {
balance = 0;
}
MySound.loadSound(AudioPath, StreamSignal);
MySound.setVolume(volume);
MySound.setPan(balance);
MySound.onSoundComplete=function(){
kugel_mc._visible = 0;
playSignal = false;
status = "Status: stopped";
}
volstatus = volume;
balstatus = balance;
pauseSignal = false;
playSignal = true;
wahlSignal = false;
_parent.onEnterFrame = function() {
total = MySound.getBytesTotal();
geladen = MySound.getBytesLoaded();
if (geladen != total) {
if (geladen != undefined && total != undefined) {
status = "Status: " + Math.round((geladen*100/total)) + "% loaded";
}
mc._xscale = Math.round((geladen*100/total));
} else {
status = "Status: 100% Loaded";
delete _parent.onEnterFrame;
kugel_mc._visible = 1;
if (!StreamSignal) {
MySound.start(pausePos, 0);
}
}
}
}
}
play_btn.onRollOver = function() {
status = "Status: load / play song";
}
play_btn.onRollOut = function() {
status = (playSignal) ? status = "Status: playing" : status = "Status: stopped";
}
// Stop Schalter
stop_btn.onRelease = function() {
MySound.stop();
playSignal = 0;
delete pausePos;
kugel_mc._visible = 0;
}
stop_btn.onRollOver = function() {
status = "Status: stop playing";
}
stop_btn.onRollOut = function() {
status = (!playSignal) ? status = "Status: stopped" : status = "Status: playing";
}
// Pause Schalter
pause_btn.onRelease = function() {
if (!wahlSignal) {
pausePos = MySound.position/1000;
MySound.stop();
pauseSignal = true;
playSignal = false;
kugel_mc._visible = 0;
status = "Status: press play";
}
}
pause_btn.onRollOver = function() {
status = (!pauseSignal) ? status = "Status: pause playing" : status = "Status: press play";
}
pause_btn.onRollOut = function() {
status = (!playSignal) ? status = "Status: stopped" : status = "Status: playing";
}
// Nächster Schalter
next_btn.onRelease = function() {
if (aktAudio<totalAudio) {
aktAudio += 1;
AudioPath = aPath[aktAudio-1];
titel = songTitel[aktAudio-1];
artist = songArtist[aktAudio-1];
MySound.stop();
playSignal = 0;
pauseSignal = 0;
wahlSignal = 1;
delete pausePos;
kugel_mc._visible = 0;
trackAnzeige = aktAudio+" / "+totalAudio;
status = "Status: stopped - press play";
setCover(aktAudio-1);
}
}
next_btn.onRollOver = function() {
dstatus = status;
status = "Status: load next song";
}
next_btn.onRollOut = function() {
if (status != "Status: stopped - press play") status = dstatus;
}
// Vorheriger Schalter
prev_btn.onRelease = function() {
if (aktAudio>1) {
aktAudio -= 1;
AudioPath = aPath[aktAudio-1];
titel = songTitel[aktAudio-1];
artist = songArtist[aktAudio-1];
MySound.stop();
playSignal = 0;
pauseSignal = 0;
wahlSignal = 1;
delete pausePos;
kugel_mc._visible = 0;
trackAnzeige = aktAudio+" / "+totalAudio;
status = "Status: stopped - press play";
setCover(aktAudio-1);
}
}
prev_btn.onRollOver = function() {
dstatus = status;
status = "Status: load prev song";
}
prev_btn.onRollOut = function() {
if (status != "Status: stopped - press play") status = dstatus;
}
// Zeit Schalter
zeit_btn.onRelease = function() {
zeitSignal = !zeitSignal;
}
zeit_btn.onRollOver = function() {
dstatus = status;
status = "Status: Total / " +t_TrackZeit.total +" - switch timedisplay ";
}
zeit_btn.onRollOut = function() {
status = dstatus;
}
// Drag Schalter
drag_btn.onPress = function() {
startDrag(this._parent, false);
}
drag_btn.onRelease = drag_btn.onReleaseOutside = function() {
stopDrag();
}
drag_btn.onRollOver = function() {
dstatus = status;
status = "Status: drag 'n' drop";
}
drag_btn.onRollOut = function() {
status = dstatus;
}
// Look Schalter
look_btn.onPress = function() {
if (_currentFrame == 2) {
cover_mc._visible = 0;
gotoAndStop(3);
} else {
cover_mc._visible = 1;
gotoAndStop(2);
setCover(aktAudio-1);
}
}
look_btn.onRollOver = function() {
dstatus = status;
status = "Status: change look - simple/extended";
}
look_btn.onRollOut = function() {
status = dstatus;
}
// Equalizer Schalter
kugel_mc._visible = 0;
// Display
onEnterFrame = function () {
_global.dauer = int(MySound.duration/1000);
_global.position = int(MySound.position/1000);
// Total Zeit
t_TrackZeit = {};
t_TrackZeit.minutes = int(_global.dauer/60);
t_TrackZeit.seconds = int(_global.dauer%60);
t_TrackZeit.total = checkDigits(t_TrackZeit.minutes)+":"+ checkDigits(t_TrackZeit.seconds);
// Bereits
b_TrackZeit = {};
b_TrackZeit.minutes = int((_global.position)/60);
b_TrackZeit.seconds = int((_global.position)%60);
b_TrackZeit.total = checkDigits(b_TrackZeit.minutes)+":"+ checkDigits(b_TrackZeit.seconds);
// Noch zu Spielen
n_TrackZeit = {};
n_TrackZeit.minutes = int((_global.dauer - _global.position )/ 60);
n_TrackZeit.seconds =int(( _global.dauer - _global.position )%60);
n_TrackZeit.total = checkDigits(n_TrackZeit.minutes)+":"+ checkDigits(n_TrackZeit.seconds);
// Ausgabe
sBalken("smc");
if (zeitSignal) {
display =n_TrackZeit.total;
} else {
display =b_TrackZeit.total;
}
// Trackslider
if (trackDrag != true) regler_mc._x = (MySound.position / MySound.duration) * sliderMax;
}
// Zweistelligkeit
function checkDigits(pWert) {
return (pWert<10) ? pWert="0"+pWert : pWert;
}
// Statusanzeige (Balken)
function sBalken(obj) {
prozent = _global.position*100/_global.dauer;
this[obj]._xscale = prozent;
prozent = parseInt(prozent)+"%";
}
// Doppelclick
movieclip.prototype.dClick = function(tempo) {
if (getTimer()-clickZeit<=tempo) return true;
clickZeit = getTimer();
}
// Prüfen des Komponenten Parameters playerlook
// (Simple/Extended Version)
if (!playerlook) gotoAndStop(3);
// Direkt Wahl
function setzeDirektwahl() {
for (var j=1; j <= 12; j++) {
this["dw" + j + "_btn"].nrtxt = j;
}
}
function setzeAudiowahl(pAkt) {
trace(pAkt);
aktAudio = pAkt;
AudioPath = aPath[aktAudio-1];
titel = songTitel[aktAudio-1];
artist = songArtist[aktAudio-1];
MySound.stop;
playSignal = 0;
pauseSignal = 0;
wahlSignal = 1;
delete pausePos;
kugel_mc._visible = 0;
trackAnzeige = aktAudio+" / "+totalAudio;
status = "Status: stopped - press play";
setCover(aktAudio-1);
}
Zuletzt bearbeitet von speedy6n2 am Fr 31.07.2009 14:03, insgesamt 2-mal bearbeitet
|
|