domanda... si può fare un player che carica mp3 esterni e che in automatico carichi l'mp3 successivo una volta terminato il precedente?! Se si, qualcuno sapremme indicarmi un tutorial o delle direttive da seguire per realizzarlo?!
grazie 1000
domanda... si può fare un player che carica mp3 esterni e che in automatico carichi l'mp3 successivo una volta terminato il precedente?! Se si, qualcuno sapremme indicarmi un tutorial o delle direttive da seguire per realizzarlo?!
grazie 1000
Io_FraNo
volendo puoi utilizzare lo stesso codice che ho usato per lo slideshow linkato in firma, solo che al posto delle immagini caricherai i suoni, e al posto del MovieClipLoader userai i metodi di controllo della classe Sound per verificare il caricamento avvenuto e la fine della riproduzione per avviare il successivo mp3
domani se riesco butto giù una cosa in questa direzione![]()
grazie and80 sei un mito, come al solito... provo e ti dico... anche se non conosco le classi del sound!... studio un pò!!!
Io_FraNo
ho buttato giù questo codice che dovrebbe fare esattamente quello che chiedi in maniera automatica... quello di cui ti devi preoccupare è solo di mettere nella stessa cartella dell'swf i tuoi mp3 con titoli sequenziali (1.mp3, 2.mp3 ecc...) il resto lo fa lui
ps. non è testato, quindi se non funziona non stupirti troppocodice:var object:Object = new Object(); object.path = this; object.index = 1; object.interval = new Number(); object.sound = new Sound(object.path); object.onLoadStart = function(){ this.interval = setInterval(this, "onLoadProgress", 20); this.sound.onLoad = function(ok){ if(ok){ this._parent["onLoadInit"](); } else { this._parent["onLoadError"](); } } this.sound.onSoundComplete = function(){ this._parent.index++; } }; object.onLoadProgress = function(){ trace(this.sound.getBytesLoaded()+" di "+this.sound.getBytesTotal()); }; object.onLoadError = function(){ this.index = 1; this.sound.loadSound(this.index+".mp3", false); }; object.onLoadInit = function(){ clearInterval(this.interval); this.sound.loadSound(this.index+".mp3", false); }; object.start = function(){ this.sound.loadSound(this.index+".mp3", false); }; object.start();![]()
ok, perfetto... lo provo! domandina... pensi che funzioneranno anche i bootncini che io gli ho creato per il play, stop, avanti e dietro?!
il comando del play per esempio è:
on (release) {
if (playing!=true) {
if (paused!=true) {
playing=true;
paused=false;
stopped=false;
myConditionText="playing";
s.start(0,0);
}
if (paused==true) {
playing=true;
paused=false;
stopped=false
s.start(myMusicPosition,0);
myConditionText="playing";
s.onSoundComplete = function() {
s.start();
}
}
}
}
e così via... dato che facevo caricare gli mp3 (4 in tutto) su quattro frames diversi, e ad ogni frame assegnavo sto comando:
s = new Sound();
s.loadSound("mp3/Track01.mp3", true);
currentTrack="Freaks";
stopped=false;
paused=false;
stop();
boh... vedi un pò se riesci a dirmi qualcosa.... intanto provo il tuo script.
Ancora grazie 1000
Io_FraNo
lo script che ti ho indicato non tiene conto della possibilità di interazione con l'utente... bisognerebbe aggiungerla... ma in questo momento non penso proprio di riuscirci
ps... non ho neanche capito come dovrebbe agire il codice di quel pulsante :master:
NB. anche questo è da verificare
ho aggiunto i metodi "play", "pause" e "stop" all'oggetto... ponendo che tu abbia tre pulsanti che operano le scelte su elencate e che ne portino lo stesso nome di istanza, puo irichiamarli direttamente sui pulsanti in questo modocodice:var object:Object = new Object(); object.path = this; object.index = 1; object.paused = false; object.pausedPosition = 0; object.interval = new Number(); object.sound = new Sound(object.path); object.onLoadStart = function(){ this.interval = setInterval(this, "onLoadProgress", 20); this.sound.onLoad = function(ok){ if(ok){ this._parent["onLoadInit"](); } else { this._parent["onLoadError"](); } } this.sound.onSoundComplete = function(){ this._parent.index++; } }; object.onLoadProgress = function(){ trace(this.sound.getBytesLoaded()+" di "+this.sound.getBytesTotal()); }; object.onLoadError = function(){ this.index = 1; this.sound.loadSound(this.index+".mp3", false); }; object.onLoadInit = function(){ clearInterval(this.interval); this.sound.loadSound(this.index+".mp3", false); }; object.play = function(){ (!this.paused)? this.sound.start() : this.sound.start(this.pausedPosition, 1); } object.stop = function(){ this.pausedPosition = 0; this.paused = false; this.sound.stop(); } object.pause = function(){ this.pausedPosition = this.sound.position; this.paused = true; this.sound.stop(); } object.start = function(){ this.sound.loadSound(this.index+".mp3", false); }; object.start();
play.onRelease = object.play;
stop.onRelease = object.stop;
pause.onRelease = object.pause;
ciao and80... domanda, ma le musiche le devo rinominare: "1"; "2"; "3"; "4"; ovviamente .mp3?!
Io_FraNo
Originariamente inviato da Io_FraNo
ciao and80... domanda, ma le musiche le devo rinominare: "1"; "2"; "3"; "4"; ovviamente .mp3?!
esattamente, per come ho scritto, si dovrebbero anche trovare nella stessa cartella del fla/swf