Foros del Web » Creando para Internet » Flash y Actionscript »

URGENTE ayuda en actionscript

Estas en el tema de URGENTE ayuda en actionscript en el foro de Flash y Actionscript en Foros del Web. Hola, quiero que alguien me ayude urgente please, resulta que tengo un mp3 player flash con un playlist en xml, llamado asi "playlist.xml" el problema ...
  #1 (permalink)  
Antiguo 23/07/2005, 20:01
 
Fecha de Ingreso: marzo-2005
Mensajes: 36
Antigüedad: 19 años, 1 mes
Puntos: 0
Exclamación URGENTE ayuda en actionscript

Hola, quiero que alguien me ayude urgente please, resulta que tengo un mp3 player flash con un playlist en xml, llamado asi "playlist.xml"
el problema es que cuando carga me muestra los tracks aletorios y yo los quiero desde el 01.mp3
aqui va el codigo
--------------------------
stop();
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;
//trace(songname[i]+" "+songfile[i]+" "+songband[i]);
}
}
_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 = "loading...";
}
};
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");
------------------------------------

y el playlist.xml
------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<songs>
<song name ="Track name" band ="artist name" file="1.mp3" />
<song name ="Test2" band ="P2L Band" file="2.mp3" />
<song name ="Test2" band ="P2L Band" file="3.mp3" />
<song name ="Test2" band ="P2L Band" file="4.mp3" />
<song name ="Test2" band ="P2L Band" file="5.mp3" />
<song name ="Test2" band ="P2L Band" file="6.mp3" />
<song name ="Test2" band ="P2L Band" file="7.mp3" />
<song name ="Test2" band ="P2L Band" file="8.mp3" />
<song name ="Test2" band ="P2L Band" file="9.mp3" />
<song name ="Test2" band ="P2L Band" file="10.mp3" />
<song name ="Test2" band ="P2L Band" file="11.mp3" />
<song name ="Test2" band ="P2L Band" file="12.mp3" />
<song name ="Test2" band ="P2L Band" file="13.mp3" />
<song name ="Test2" band ="P2L Band" file="14.mp3" />
</songs>
----------------------------------

por favor es urgente gracias.
  #2 (permalink)  
Antiguo 23/07/2005, 23:51
Avatar de stock  
Fecha de Ingreso: junio-2004
Ubicación: Monterrey NL
Mensajes: 2.390
Antigüedad: 19 años, 9 meses
Puntos: 53
Holas!!

asi nomas de rapido e checado tu codigo, y es que estas tomando una cancion al azar exactamente donde te puse en negrita la primera linia, para solucionar eso, le agrege la segunda linia en negrita y le quite la primera...

intenta hacer eso, quiza funcione!!

have funn

stop();
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;
//trace(songname[i]+" "+songfile[i]+" "+songband[i]);
}
}
_root.createEmptyMovieClip("sound_mc", 1);


//_global.song_nr = random(songfile.length);
_global.song_nr = 1;

_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 = "loading...";
}
};
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");
  #3 (permalink)  
Antiguo 23/07/2005, 23:53
Avatar de stock  
Fecha de Ingreso: junio-2004
Ubicación: Monterrey NL
Mensajes: 2.390
Antigüedad: 19 años, 9 meses
Puntos: 53
por cierto, parece ser un buen reproductor

me podrias pasar el archivo??

thanks!!
  #4 (permalink)  
Antiguo 24/07/2005, 02:28
 
Fecha de Ingreso: marzo-2005
Mensajes: 36
Antigüedad: 19 años, 1 mes
Puntos: 0
Muchas gracias... te pasaste, lo unico que no es un 1, es un 0, ya que con el 1 me toma el track2. pero un detalle solamente, te pasaste, ahora como te puedo pasar ese archivo? mandame un mensaje privado con tu E-Mail.
nos leemos, bye y gracias.
  #5 (permalink)  
Antiguo 24/07/2005, 22:26
 
Fecha de Ingreso: marzo-2005
Mensajes: 36
Antigüedad: 19 años, 1 mes
Puntos: 0
Exclamación otro problem

hui puros problemas con esta cosa... sabes tu o alguien por que esta cosa hace un fade out y cambia de track cuando este lleva 3:00 aprox.
  #6 (permalink)  
Antiguo 25/07/2005, 09:14
 
Fecha de Ingreso: junio-2005
Mensajes: 3
Antigüedad: 18 años, 10 meses
Puntos: 0
Me interesa el script, alguien me lo puede pasar completo en el flash?
Trataré de responder a las dudas que surjan de él viéndolo en acción.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:51.