Ahora tengo otra duda, quiero aplicar si siguiente:
Tengo una player de video que tiene el siguiente script:
Código :
function playMovie()
{
if (!isStarted)
{
ns.play(file);
playText.txt.text = "loading ..";
isStarted = true;
}
else
{
ns.pause();
} // end if
encendido._visible = true;
playBut._visible = true;
} // End of the function
function pauseMovie()
{
ns.pause();
playBut._visible = true;
encendido._visible = false;
} // End of the function
//Link a video -------------------------------------------------
!_root.file ? (file = "video.flv",
file = "video.flv") : (file = _root.file);
!_root.autoStart ? (autoStart = true, autoStart = true) : (autoStart = _root.autoStart);
w = 300;
h = 260;
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
// RETRASAR TIEMPO DE CARGA
ns.setBufferTime(5);
this.createEmptyMovieClip("snd", 0);
snd.attachAudio(ns);
audio = new Sound(snd);
unmuteBut._visible = false;
videoDisplay.attachVideo(ns);
ns.onMetaData = function (obj)
{
this.totalTime = obj.duration;
};
ns.onStatus = function (object)
{
if (object.code == "NetStream.Play.Start")
{
}
else if (object.code == "NetStream.Buffer.Full")
{
}
else if (object.code == "NetStream.Play.Stop")
{
ns.seek(0);
ns.pause();
playBut._visible = true;
encendido._visible = false;
} // end if
};
videoBg.onPress = function ()
{
if (encendido._visible == false)
{
playMovie();
}
else
{
pauseMovie();
} // end if
};
pauseBut.onPress = function() {
pauseMovie();
};
playBut.onPress = function() {
playMovie();
};
percentBar.onEnterFrame = function ()
{
loaded = this._parent.ns.bytesLoaded;
total = this._parent.ns.bytesTotal;
if (loaded == total && loaded > 1000)
{
percentBar._width = bw;
delete this.onEnterFrame;
}
else
{
percentBar._width = int(bw * loaded / total);
} // end if
};
progressBar.onEnterFrame = function ()
{
this._width = bw * ns.time / ns.totalTime;
};
centerBg.onPress = function ()
{
this.onEnterFrame = function ()
{
scl = this._xmouse * this._xscale / bw / 100;
ns.seek(scl * ns.totalTime);
};
};
centerBg.onRelease = centerBg.onReleaseOutside = function ()
{
delete this.onEnterFrame;
encendido._visible == true ? (videoDisplay.pause()) : (null);
};
muteBut.onPress = function ()
{
audio.setVolume(0);
unmuteBut._visible = true;
this._visible = false;
};
unmuteBut.onPress = function ()
{
audio.setVolume(100);
muteBut._visible = true;
this._visible = false;
};
videoDisplay._width = videoBg._width = w;
videoDisplay._height = videoBg._height = h - 20;
playText._x = w / 2;
playText._y = h / 2 - 10;
leftBg._x = 0;
leftBg._y = h - 20;
playBut._x = pauseBut._x = 12;
playBut._y = pauseBut._y = h - 10;
// Corre a la derecha o izquierda la barra de estado
centerBg._x = percentBar._x = progressBar._x = backBar._x = 78;
centerBg._y = h - 20;
percentBar._y = progressBar._y = h - 12;
// reducir tamaño de la barra de estado
bw = centerBg._width = percentBar._width = progressBar._width = w - 120;
rightBg._x = w - 21;
rightBg._y = h - 20;
muteBut._x = unmuteBut._x = w - 11;
muteBut._y = unmuteBut._y = h - 10;
if (autoStart == true)
{
playMovie();
}
else
{
encendido._visible = false;
} // end if
Largo no? jeje... donde dice:
Código :
//Link a video -------------------------------------------------
!_root.file ? (file = "video.flv",
file = "video.flv") : (file = _root.file);
quiero hacer que desde un xml externo se pueda modificar los links al video. traté de colocar como me explicó heberto arriba pero cuando lo hago no me sale, no se si será que a la variable que le asigno al estar encerrada entre " " no funciona porque ya no es una variable. O por que es? alquien sabe?.
Desde aquí pueden bajar el Fla. si es que necesitan ver como funciona y probarlo.
Saludos y mmuchas gracias