Welcome to the Graphic and Web Design Forum


your forum for all things Design


  •  » Graphic Design
  •  » Web Design
  •  » Logos and Branding
  •  » Illustration
  •  » Photography
  •  » Design Tutorials
  •  » Plenty of Off Topic Chat

Register now to remove this ad box


YES! I want to register an account for free right now!


-->
  1. #1

    Telling an FLV to stop once finished


    REGISTER TO REMOVE ADS


    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.

    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));
    }
    Thanks in advance!

  2. #2
    What flv player are you using?

  3. #3

    REGISTER TO REMOVE ADS


    Just one that I followed a tutorial on through gotoandlearn.com

Similar Threads

  1. GotoAndPlay once FLV is finished?
    By bdavey311 in forum Flash Forum
    Replies: 8
    Last Post: 29-07-2009, 10:36 AM
  2. Layout finished, any opinions?
    By Alexa in forum Graphic Design & Web Design Critique
    Replies: 8
    Last Post: 16-06-2009, 01:27 PM
  3. Finished - Take a look
    By DanielMartin in forum Illustration Graphic Design
    Replies: 24
    Last Post: 25-02-2009, 04:55 PM
  4. I have just finished my new web site
    By TigerHobbs in forum Web Design Forum Showcase
    Replies: 5
    Last Post: 11-02-2009, 12:36 PM
  5. Not finished, but how's it look?
    By DeChamp in forum Web Design Forum Showcase
    Replies: 12
    Last Post: 08-12-2007, 08:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in