I set up a flash video player using some code from tutorials. But right now, it just keeps going through and looping, playing until the end of time. How can I just have it stay paused once it completes?
Here is the code:Code: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") { ns.seek(0); } } UnityRingsWEB.attachVideo(ns); ns.play("flv/UnityRingsWEB.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