var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(5);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
if (info.code == "NetStream.Play.Stop") {
bufferClip.seek(0);
gotoAndPlay("Animation", 1);
}
}
theVideo.attachVideo(ns);
ns.play("clip.flv");
rewindButton.onRelease = function () {
ns.seek(0);
}
playButton.onRelease = function () {
ns.pause();
}
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 720;
loader.scrub._x = ns.time / duration * 720;
}
I’m having a problem with this Actionscript WITH ONLY the loadbar…it’s weird because my scrubber works but my loadbar doesn’t.
It’s suppose to gradually grow in length as the FLV is loaded but it’s not once the video is fully downloaded it goes from 0 to 100%.
I believe the problem is in this somewhere but I don’t know why?
[COLOR=red]amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 720;[/COLOR]