Ho fatto un player mp3, ma non funziona online, mentre nel flashPlayer funziona benissimo.
questo è lo script che ho usato, mi sapreste suggerire?
Grazie
..Ikniv
==============================================
//variabili globali
_global.Player = this;
//
//------------------------------------------------------------------------
Player.createEmptyMovieClip("Contiene1", 1);
Player.createEmptyMovieClip("Contiene2", 2);
Player.createEmptyMovieClip("Contiene3", 3);
//
brano1 = new Sound(Contiene1);
//
brano1.loadSound("Sound1.mp3", false);
brano1.onLoad = function() {
brano1.start(0, 2000);
};
qualeBrano = 1;
//
function preloadSound(brano) {
var bT:Number = brano.getBytesTotal();
var bL:Number = brano.getBytesLoaded();
var pB = Math.floor(bL/bT*100);
caricato = "LOADED: "+pB+"%";
if ((bT == bL) && (bT>0) && (bT != NaN)) {
clearInterval(buffer);
}
}
//
function stoppaBrani() {
brano1.stop();
brano2.stop();
brano3.stop();
delete brano1;
delete brano2;
delete brano3;
}
//sullo stage nel MC del Player c'è un MC (cVolume) che contiene un'altro MC (regolo) il cui valore _x regola il volume
function settaVolume(branoDaSettare) {
branoDaSettare.setVolume(Math.round(cVolume.regolo ._x*2));
}
//
settaggio = setInterval(settaVolume, 500, brano1);
buffer = setInterval(preloadSound, 1000, brano1);
//
//---------------------------------------------variabili<<
statoMusica = "on";
//-----------------------------------settaggi<<
//bt1, bt2 e bt3 sono i MC che scelgono la canzone e hanno due frame, uno illuminato ("on") e uno spento ("off")
//onOff è un bottone con la stessa struttura dei bt1, bt2, bt3.
bt1.gotoAndStop("on");
bt2.gotoAndStop("off");
bt3.gotoAndStop("off");
//
bt1.onRelease = function() {
stoppaBrani();
qualeBrano = 1;
clearInterval(settaggio);
clearInterval(buffer);
//
brano1 = new Sound(Contiene1);
brano1.loadSound("Sound1.mp3", false);
brano1.onLoad = function() {
brano1.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano1);
settaggio = setInterval(settaVolume, 500, brano1);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("on");
bt2.gotoAndStop("off");
bt3.gotoAndStop("off");
};
//
bt2.onRelease = function() {
stoppaBrani();
qualeBrano = 2;
clearInterval(settaggio);
clearInterval(buffer);
//
brano2 = new Sound(Contiene2);
brano2.loadSound("Sound2.mp3", false);
brano2.onLoad = function() {
brano2.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano2);
settaggio = setInterval(settaVolume, 500, brano2);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("off");
bt2.gotoAndStop("on");
bt3.gotoAndStop("off");
};
//
bt3.onRelease = function() {
stoppaBrani();
qualeBrano = 3;
clearInterval(settaggio);
clearInterval(buffer);
//
brano3 = new Sound(Contiene3);
brano3.loadSound("Sound3.mp3", false);
brano3.onLoad = function() {
brano3.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano3);
settaggio = setInterval(settaVolume, 500, brano3);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("off");
bt2.gotoAndStop("off");
bt3.gotoAndStop("on");
};
//
onOff.onRelease = function() {
if (statoMusica == "on") {
//spegne la musica
stoppaBrani();
clearInterval(settaggio);
clearInterval(buffer);
onOff.gotoAndStop("off");
statoMusica = "off";
} else if (statoMusica == "off") {
//accende la musica
if (qualeBrano == 1) {
qualeBrano = 1;
clearInterval(settaggio);
clearInterval(buffer);
stoppaBrani();
//
brano1 = new Sound(Contiene1);
brano1.loadSound("Sound1.mp3", false);
brano1.onLoad = function() {
brano1.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano1);
settaggio = setInterval(settaVolume, 500, brano1);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("on");
bt2.gotoAndStop("off");
bt3.gotoAndStop("off");
} else if (qualeBrano == 2) {
qualeBrano = 2;
clearInterval(settaggio);
clearInterval(buffer);
stoppaBrani();
//
brano2 = new Sound(Contiene2);
brano2.loadSound("Sound2.mp3", false);
brano2.onLoad = function() {
brano2.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano2);
settaggio = setInterval(settaVolume, 500, brano2);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("off");
bt2.gotoAndStop("on");
bt3.gotoAndStop("off");
} else if (qualeBrano == 3) {
qualeBrano = 3;
clearInterval(settaggio);
clearInterval(buffer);
stoppaBrani();
//
brano3 = new Sound(Contiene3);
brano3.loadSound("Sound3.mp3", false);
brano3.onLoad = function() {
brano3.start(0, 2000);
};
//
buffer = setInterval(preloadSound, 1000, brano3);
settaggio = setInterval(settaVolume, 500, brano3);
statoMusica = "on";
onOff.gotoAndStop("on");
bt1.gotoAndStop("off");
bt2.gotoAndStop("off");
bt3.gotoAndStop("on");
}
}
};
//
xRegolo = 25;
cVolume.onPress = function() {
cVolume.regolo.startDrag(true, 0, cVolume.regolo._y, 50, cVolume.regolo._y);
};
cVolume.onRelease = cVolume.onReleaseOutside=function () {
stopDrag();
cVolume.regolo._x = Math.round(cVolume.regolo._x);
};
//
stop();