hi there, i have made a FLV player in flash mx 2004 with the netStream(); class… this player works loading the flv’s from url’s provided by a XML file.
here is the code for the player:
//
//
var nc = new NetConnection();
nc.connect(null);
textocarga._visible = true;
var ns = new NetStream(nc);
this.loadVideo.attachVideo(ns);
ns.setBufferTime(10);
ns.onStatus = function(info) {
if (info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
// end if
if (info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
// end if
if (info.code == "NetStream.Play.Stop") {
ns.seek(0);
}
// end if
};
//
numeroz = _global.elNumber;
//
//
function playFromXml(ruta) {
laruta = _global.elArray[numeroz];
ns.play(laruta);
}
playBtn.onRelease = function() {
ns.pause();
};
prevPage.onRelease = function() {
numeroz--;
if (numeroz<2) {
this._visible = false;
playFromXml(numeroz);
}
if (numeroz<_global.maxNumber) {
this._parent.nextPage._visible = true;
}
trace(numeroz);
playFromXml(numeroz);
};
nextPage.onRelease = function() {
numeroz++;
trace(numeroz);
if (numeroz == _global.maxNumber) {
this._visible = false;
}
if (numeroz>1) {
this._parent.prevPage._visible = true;
}
playFromXml(numeroz);
};
playFromXml(numeroz);
//
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
ns.onMetaData = function(obj) {
duration = obj.duration;
};
var scrubInterval;
//
function videoStatus() {
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
timelineIndi._xscale = Math.round((ns.time/duration)*100);
timelineIndi._alpha = 50;
videocargado._width = Math.round(amountLoaded*200);
textocarga.text = Math.round(amountLoaded*100)+"%";
textocarga._x = 55+Math.round(amountLoaded*200);
if (amountLoaded == 100) {
textocarga._alpha = 0;
}
}
///
_root.createEmptyMovieClip("vSound", _root.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(100);
mute.onRelease = function() {
if (so.getVolume() == 100) {
so.setVolume(0);
} else {
so.setVolume(100);
}
// end if
};
//
And when i test it in flash 8 (ctrl+enter) doesn’t work, but when i test it in a html file does work.
I did this file in flash mx2004 and i finished in flash 8.
Anyone has this same problem with flv.??
theguaz