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

[SOLUCIONADO] AS2 videos con matriz

Estas en el tema de AS2 videos con matriz en el foro de Flash y Actionscript en Foros del Web. Hola. Estoy tratando de navegar por una matriz de videos y agregué los botones "proximo" y "anterior" y el problema que "a veces funcionan bien" ...
  #1 (permalink)  
Antiguo 07/03/2013, 13:49
 
Fecha de Ingreso: agosto-2012
Mensajes: 9
Antigüedad: 11 años, 8 meses
Puntos: 1
Pregunta AS2 videos con matriz

Hola.
Estoy tratando de navegar por una matriz de videos y agregué los botones "proximo" y "anterior" y el problema que "a veces funcionan bien" y a veces no (a veces hay que hacer doble click para que se salte al otro video). Tal vez alguien me pueda orientar si falta algo de código o lo que puse no está bien.
Este es e código.
var videos:Array = new Array("videos/1.mp4", "videos/2.mp4", "videos/3.mp4", "videos/4.mp4", "videos/5.mp4", "videos/6.mp4", "videos/7.mp4");
var currentVideo:Number = 0;
var duration:Number = 0;
var ready:Boolean = true;
var nc:NetConnection = new NetConnection();
nc.connect(null);
ventajas;
var ns:NetStream = new NetStream(nc);
videoPlayer.attachVideo(ns);
ns.play(videos[currentVideo]);
ns.onMetaData = function(evt:Object):Void
{
duration = evt.duration;
ready = true;
};
ns.onStatus = function(evt:Object):Void
{
if (ready && this.time > 0 && this.time >= (duration - 0.5))
{
ready = false;
currentVideo++;
if (currentVideo < videos.length)
{
ns.play(videos[currentVideo]);
}
else
{
delete this.onStatus;
}
}
};
/////////////////////////////esto se lo agregué//////////////////////////
btn_proximo.onRelease = function()
{
ns.play(videos[currentVideo++]);
trace("proximo");
};
btn_anterior.onRelease = function()
{
ns.play(videos[currentVideo--]);
trace("anterior");
};
  #2 (permalink)  
Antiguo 09/03/2013, 08:44
 
Fecha de Ingreso: agosto-2012
Mensajes: 9
Antigüedad: 11 años, 8 meses
Puntos: 1
Solucionado!!!!!!!!!!!!!!!

FUNCION STATUS
ns.onStatus = function(info)
{
if (info.code == "NetStream.Play.Stop")
{
currentVideo++;
if (currentVideo >= myVideo.length)
{
currentVideo = 0;
}
ns.play(myVideo[currentVideo]);
}
};
/////////////////////////////////////////////////////////////////////////////////////////////
LOS BOTONES
btn_anterior.onRelease = function()
{
currentVideo--;
if (currentVideo == -1)
{
currentVideo = myVideo.length - 1;
}
ns.play(myVideo[currentVideo]);

};
/////////////////////////////////////////////////////////////////////////////////////////////
btn_proximo.onRelease = function()
{
currentVideo++;
if (currentVideo >= myVideo.length)
{
currentVideo = 0;//
}
ns.play(myVideo[currentVideo]);


};

Rakatan

Etiquetas: as2, matriz, videos
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 04:42.