I’ve got the below code on 3 frames in my movie (with the requisite changes relative to the appropriate FLV’s I’m loading).
The buffer clip works when the first FLV starts to load. But, when I select one of my buttons (thereby taking the playhead to another frame where it loads another FLV) the buffer clip doesn’t play.
Not sure why. Do I need to clear the buffer within an onRelease?
Here’s the site:http://www.thevisualgospel.org/
(click on ‘here’ with in the intro text block) or follow the menus:
The Project > Videos
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play(“vid1.flv”);
playBtn.onRelease = function() {
ns.pause();
}
pauseBtn.onRelease = function() {
ns.pause();
}
ns.setBufferTime(10);
ns.onStatus = function(info) {
trace(info.code);
if(info.code == “NetStream.Buffer.Full”) {
bufferClip._visible = false;
}
if(info.code == “NetStream.Buffer.Empty”) {
bufferClip._visible = true;
}
if(info.code == “NetStream.Play.Stop”) {
ns.seek(0);
}
}
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 * 180;
loader.scrub._x = ns.time / duration * 180;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,180,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/180)*duration));
}
project_btn.onRelease = function() {
ns.pause();
gotoAndPlay(2);
}
our_btn.onRelease = function() {
ns.pause();
gotoAndPlay(3);
}
stop();