Comunidad de diseño web y desarrollo en internet online

Fade Out y Streaming con XML

Citar            
MensajeEscrito el 15 Sep 2006 04:00 am
Hola estuve haciendo este ejercicio:
http://www.mmug.cl/tercer/20060819203356_3_1_1_2.swf
y está muy bueno !

Ahora me pregunto como puedo cortar el sonido con un Fade out al apretar Stop o cualquier otro Botón??

Acá va el código:

playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
if (success) {
_global.songname = [];
_global.songband = [];
_global.songfile = [];
for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
_global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
}
}
_root.createEmptyMovieClip("sound_mc", 1);
_global.song_nr = random(songfile.length);
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
function timer(sound_obj) {
time = sound_obj.position/1000;
min = Math.floor(time/60);
min = (min<10) ? "0"+min : min;
sec = Math.floor(time%60);
sec = (sec<10) ? "0"+sec : sec;
timeDisplay_txt.text = min+":"+sec;
}
MovieClip.prototype.songStarter = function(file, name, band) {
if (this.sound_obj) {
this.sound_obj.stop();
delete this.sound_obj;
}
this.sound_obj = new Sound(this);
this.sound_obj.loadSound(file, true);
this.onEnterFrame = function() {
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text = name+"."+band;
timeInterval = setInterval(timer, 1000, this.sound_obj);
} else {
this._parent.display_txt.text = "Cargando...";
}
};
this.sound_obj.onSoundComplete = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
this._parent.volume1.dragger.onPress = function() {
startDrag(this, true, 0, this._y, this._parent.volBG._width, this._y);
this.onEnterFrame = function() {
var p = (this._x/this._parent.volBG._width)*100;
this._parent._parent.sound_mc.sound_obj.setVolume(p);
};
};
this._parent.volume1.dragger.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
};
this._parent.volume1.dragger.onReleaseOutside = function() {
stopDrag();
};
};
btn_play.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
btn_stop.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
btn_rev.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
playlist.load("playlist.xml");

Gracias!!

Por kiltroconpulgas

96 de clabLevel



 

safari
Citar            
MensajeEscrito el 15 Sep 2006 09:49 am
Pues sí, encontrarás montones de códigos FadeIn y FadeOut por Google y por el mismo foro.

Por Elecash

Claber

8126 de clabLevel

37 tutoriales
19 articulos
13 ejemplos

  Bastard Operators From Hell Desarrollador de GAIA Premio_Secretos Héroes

BarnaCity

firefox
Citar            
MensajeEscrito el 15 Sep 2006 03:16 pm
Si, ya lo intenté, bueque en google, acá en el mmug y en varios sitios más sigo buscando. Y lo que he encontrado es un fade out pero con attachsound, ahora no se si esto se aplicará al código que publiqué. Según lo que entiendo no funcionaría, por eso que pido ayuda a expertos en el tema.

Este es un código que encontré:

s = new Sound(this);
s.attachSound("mySound");
s.setVolume(0);
s.start(0, 9999);

s.setVolume(s.getVolume += 1)

if(s.getVolume == 100) {
gotoAndStop(4);
} else {
gotoAndPlay(2);
}

Como pueden ver utiliza mas frames, y yo tengo todo en un solo frame.... hay otros...

Bueno si alguien se le ocurre como hacerlo reugo me responda, gracias.

Por kiltroconpulgas

96 de clabLevel



 

safari

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.