Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 12-11-2006, 10:13   #1 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 167
mp3 player stop

hallo, habe einen schicken mp3 player gefunden.. gefällt mir sehr gut. der player lädt die titel aus der xml und fängt dann an abzuspielen. genau das möchte ich nicht. kann mir einer nen tip geben was ich ändern müsste damit der die titel nur abspielt wenn man play drückt? also nicht automatisch anfängt die titel abzuspielen?

hier mal das skript

Code:
// XML ladefunktion _____________________________________
songdaten = new XML();
songdaten.ignoreWhite = true;
songdaten.load("Songs.xml");

songdaten.onLoad = function(status){
	
	if ( status && this.loaded ){
			anz_songs = songdaten.firstChild.childNodes.length;
			trace("Anzahl der Tracks: "+anz_songs);
			geladen = true;
			aktsong = 0;
			ladeSong(aktsong);
			
		}
	else {
			trace("XML Ladevorgang fehlgeschlagen");
		 }
}
// Mp3 ladefunktion ____________________________________
function ladeSong(psong) {
	mp3 = songdaten.firstChild.childNodes[psong].attributes.mp3;
	titel = songdaten.firstChild.childNodes[psong].attributes.Titel;
	bps = songdaten.firstChild.childNodes[psong].attributes.bps;
	xml_sound = new Sound();
	xml_sound.loadSound(mp3,true);
	posi_txt = "00:00";
	this.onEnterFrame = function (){
		if(xml_sound.position==0){
		titel_txt = "loading...";
		}
		else {
			  gibPosition();
			  titel_txt = titel;
		}
		}
	xml_sound.setVolume(100);
	gibVolume();
	bps_txt = bps;
	titel_txt = titel;
	
	// wenn Song fertig , spring einen weiter, oder von vorne
	xml_sound.onSoundComplete = function() { 
		trace("Song fertig");
		if ( aktsong<anz_songs-1 ){
			aktsong++;
			ladeSong(aktsong);
			}
			else {
				aktsong = 0;
				ladeSong(aktsong);
				}
			}
}
// Positionsfunktion ____________________________________
function gibPosition() {
	posi = xml_sound.position/1000;
	min = Math.floor(posi/60);//Minuten berechnen
    min=(min<10)? "0"+min : min;//ggf. bei den Minuten ne 0 vorne dran
    sek = Math.floor(posi%60);//Sekunden berechnen
    sek=(sek<10)? "0"+sek : sek;//ggf. bei den Sekunden ne 0 vorne dran
    posi_txt = min+":"+sek;//Zeitausgabe ins Textfeld
}

// Volumenanzeigefunktion _______________________________
function gibVolume() {
	vol = xml_sound.getVolume();
	vol_txt = vol;
}

// Buttons _______________________________________________
pause_but.onPress = function () {
	xml_sound.stop();
	position = Math.round(xml_sound.position/1000);
}

start_but.onPress = function () {
	xml_sound.start(posi,1);
}
zurueck_but.onPress = function () {
	if ( geladen && aktsong&&anz_songs > 0 ){
	aktsong--;
	ladeSong(aktsong);
	}
	else{};
}
vor_but.onPress = function () {
	if ( geladen && aktsong<anz_songs-1 ){
	aktsong++;
	ladeSong(aktsong);
	}
}
vorspulen_but.onPress = function () {
	position = Math.round((xml_sound.position/1000)+5);
	trace(position);
	xml_sound.start(position);
}
zurueckspulen_but.onPress = function () {
	position = Math.round((xml_sound.position/1000)-5);
	xml_sound.start(position);
}
plus_but.onPress = function (vol) {
	vol = xml_sound.getVolume();
	if (vol < 100) {	
	xml_sound.setVolume(vol + 10);
	gibVolume();
	trace(xml_sound.getVolume());
	}
}
minus_but.onPress = function (vol) {
	vol = xml_sound.getVolume();
	if (vol > 0) {
	xml_sound.setVolume(vol - 10);
	gibVolume();
	trace(xml_sound.getVolume());
	}
}
// Ende ___________________________________________________
danke und gruss
beazmusix ist offline   Mit Zitat antworten
Alt 12-11-2006, 13:26   #2 (permalink)
class public{}
 
Benutzerbild von public
 
Registriert seit: Feb 2004
Ort: dessau
Beiträge: 1.406
PHP-Code:
// XML ladefunktion _____________________________________
songdaten = new XML ();
songdaten.ignoreWhite true;
songdaten.load ("Songs.xml");
songdaten.onLoad = function (status) {
    if (
status && this.loaded) {
        
anz_songs songdaten.firstChild.childNodes.length;
        
trace ("Anzahl der Tracks: " anz_songs);
        
geladen true;
        
aktsong 0;
        
ladeSong (aktsong);
    } else {
        
trace ("XML Ladevorgang fehlgeschlagen");
    }
};
// Mp3 ladefunktion ____________________________________
function ladeSong (psong) {
    
mp3 songdaten.firstChild.childNodes[psong].attributes.mp3;
    
titel songdaten.firstChild.childNodes[psong].attributes.Titel;
    
bps songdaten.firstChild.childNodes[psong].attributes.bps;
    
xml_sound = new Sound ();
    
xml_sound.loadSound (mp3true);
    
xml_sound.stop(); //<-------------------------------------------------- hier n stop()
    
posi_txt "00:00";
    
this.onEnterFrame = function () {
        if (
xml_sound.position == 0) {
            
titel_txt "loading...";
        } else {
            
gibPosition ();
            
titel_txt titel;
        }
    };
    
xml_sound.setVolume (100);
    
gibVolume ();
    
bps_txt bps;
    
titel_txt titel;
    
// wenn Song fertig , spring einen weiter, oder von vorne
    
xml_sound.onSoundComplete = function () {
        
trace ("Song fertig");
        if (
aktsong anz_songs 1) {
            
aktsong++;
            
ladeSong (aktsong);
        } else {
            
aktsong 0;
            
ladeSong (aktsong);
        }
    };
}
// Positionsfunktion ____________________________________
function gibPosition () {
    
posi xml_sound.position 1000;
    
min Math.floor (posi 60);
    
//Minuten berechnen
    
min = (min 10) ? "0" min min;
    
//ggf. bei den Minuten ne 0 vorne dran
    
sek Math.floor (posi 60);
    
//Sekunden berechnen
    
sek = (sek 10) ? "0" sek sek;
    
//ggf. bei den Sekunden ne 0 vorne dran
    
posi_txt min ":" sek;
    
//Zeitausgabe ins Textfeld
}
// Volumenanzeigefunktion _______________________________
function gibVolume () {
    
vol xml_sound.getVolume ();
    
vol_txt vol;
}
// Buttons _______________________________________________
pause_but.onPress = function () {
    
xml_sound.stop ();
    
position Math.round (xml_sound.position 1000);
};
start_but.onPress = function () {
    
xml_sound.start (posi1);
};
zurueck_but.onPress = function () {
    if (
geladen && aktsong && anz_songs 0) {
        
aktsong--;
        
ladeSong (aktsong);
    } else {
    }
};
vor_but.onPress = function () {
    if (
geladen && aktsong anz_songs 1) {
        
aktsong++;
        
ladeSong (aktsong);
    }
};
vorspulen_but.onPress = function () {
    
position Math.round ((xml_sound.position 1000) + 5);
    
trace (position);
    
xml_sound.start (position);
};
zurueckspulen_but.onPress = function () {
    
position Math.round ((xml_sound.position 1000) - 5);
    
xml_sound.start (position);
};
plus_but.onPress = function (vol) {
    
vol xml_sound.getVolume ();
    if (
vol 100) {
        
xml_sound.setVolume (vol 10);
        
gibVolume ();
        
trace (xml_sound.getVolume ());
    }
};
minus_but.onPress = function (vol) {
    
vol xml_sound.getVolume ();
    if (
vol 0) {
        
xml_sound.setVolume (vol 10);
        
gibVolume ();
        
trace (xml_sound.getVolume ());
    }
};
// Ende ___________________________________________________ 
public ist offline   Mit Zitat antworten
Alt 13-11-2006, 17:49   #3 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 167
super klappt wunderbar... nur komischer weise steht dann immer loading da... wäre schon nicht schlecht wenn er den eingelesen titel schon mal anzeigt.. oder zumindest pause oder sowas


ich hab auch shcon versucht den stop befehl woanders zu positionieren.. passiert aber immer das gleiche *schnief*


gruss
beazmusix ist offline   Mit Zitat antworten
Alt 13-11-2006, 18:41   #4 (permalink)
class public{}
 
Benutzerbild von public
 
Registriert seit: Feb 2004
Ort: dessau
Beiträge: 1.406
da musste denk ik ma noch n bissle rumprobiern....weil ik würd den player eh anders progen...also mit ner status abfrage und den staus setzen
public ist offline   Mit Zitat antworten
Alt 14-11-2006, 08:54   #5 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 167
schaaade, hab gestern noch den ganzen abend rumprobiert.. aber irgendwie geht dann garnix mehr *grins*

naja danke dir jedenfalls !!!! sehr lieb

gruss mathias
beazmusix ist offline   Mit Zitat antworten
Alt 22-11-2006, 12:34   #6 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 167
so ich muss nochmal in die runde fragen.. hab jetz hier echt ne ganze weile versucht das teil so zu stopen das der titel trotzdem noch angezeigt wird.. aber ich kann machen was ich will wenn ich den player selber per skript stope steht da nur ..loading.. das is aber schlecht weil so keiner daran denkt das der player eigentlich schon fertig ist.. also kommt auch keiner auf idee den knopf zu drücken da sie ja denken er lädt noch..

egal an welche position ich das stop setze.. entweder steht da loading oder es geht garnix mehr

wäre suuuper nett wenn da nochma jemmand drüber schauen könnte


gruss mathias
beazmusix 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 01:03 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele