Can anybody take a look at my code and tell me how I would just get the video to stop once it reaches the end? Right now it just loops.
Thanks in advance!Code:var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); ns.setBufferTime(3); 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") { ns.seek(0); } } video.attachVideo(ns); ns.play("modules/m1-s2.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 * 461; loader.scrub._x = ns.time / duration * 431; } var scrubInterval; loader.scrub.onPress = function() { clearInterval(videoInterval); scrubInterval = setInterval(scrubit,10); this.startDrag(false,0,this._y,431,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/431)*duration)); }



LinkBack URL