Elapsed time in Flash for flv files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmgann
    New Member
    • Mar 2008
    • 1

    Elapsed time in Flash for flv files

    Hi! I'm new to all this. I need help.

    I imported a quicktime movie and am using Flash skins and actionscript I found online. However, I ended up playing the quicktime flv twice in succession and the controls working on the top only. Once I pause the timer kept going and I could still hear the audio.

    I'm not big on actionscript and would love some help. Here's the script I'm using.
    Code:
     
    stop();
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
     
    var ns:NetStream = new NetStream(nc);
     
    ns.setBufferTime(30);
    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._visible = 0;
    }
    }
     
    theVideo.attachVideo(ns);
     
    ns.play("WordPlay.flv");
     
    var time_interval:Number = setInterval(checkTime, 500, ns);
    function checkTime(myVideo_ns:NetStream) {
    var ns_seconds:Number = myVideo_ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60)
    if (seconds<10) {
    seconds = ("0"+seconds);
    }
    time_txt.text = minutes+":"+seconds;
    }; 
     
     
    rewindButton.onRelease = function() {
    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 * 210;
    loader.scrub._x = ns.time / duration * 210;
    }
     
    var scrubInterval;
     
    loader.scrub.onPress = function(){
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit,10);
    this.startDrag(false,0,this._y,210,this._y);
    }
     
    loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus,100);
    this.stopDrag();
    }
    Last edited by amitpatel66; Mar 14 '08, 05:26 PM. Reason: code tags
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Thread moved to Action Script forum

    MODERATOR

    Comment

    Working...