A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help! Pause FLV on start? Using Gotoandlearn

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    222

    Help! Pause FLV on start? Using Gotoandlearn

    Hello fellow flashers,

    i've already wasted hours trying to trouble shoot and I am really in need of your wisdom. I am scratching my head here trying to figure out some basic (i think) FLV functionality. I am using the gotoandlearn tutorials which seems work but I need to add more functionality. First of all, my flash needs to be flash 7 so no FLVplayback component for me. wah.

    Here's the additional functionality:

    1) Pause FLV at start
    2) At the end of the movie have it go back to the beginning and pause. I've tried the "Complete" syntax and the following code but with no luck.

    ns.onStatus = function(infoObject:Object) {
    if(Info.code == "NetSteam.Play.Stop") {
    ns.seek(0);
    }

    }

    3) Have a step forward and step backward button - couldn't find tutorials on this.
    4) Volume slider...

    Here's the code I am using to play the FLV and do some scrubbing:

    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.setBufferTime(30);

    theVideo.attachVideo(ns);
    ns.play("URLtoMOVIE");

    rewindButton.onRelease = function() {
    ns.seek(0);
    };
    playBut.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*69;
    loader.scrub._x = ns.time/duration*68;
    }

    var scrubInterval;

    loader.scrub.onPress = function() {
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit,10);
    this.startDrag(false,-2,this._y, 68, 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/68) *duration));
    }

    It also seems to be cutting 2 seconds off at the end!!!!

    Anyway, I've been searching high and low for tutorials and I am in desperate need of help. PLEASE PLEASE PLEASE HELP!!! Cheers!!!!!!!!!!!!!!!!!!!!!!!
    You have to think in Flash

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    i havent gone through your whole post because i noticed an error right in the beginning

    it should be

    Code:
    ns.onStatus = function(infoObject:Object) {
       if(infoObject.code == "NetSteam.Play.Stop") {
       ns.seek(0);
      }
    }
    for scrubbing you can check out my flv player in my library as well ..hope it helps..

    what do u mean step forward and backward? do u mean a previous and next button?
    Last edited by silentweed; 04-29-2007 at 05:39 AM.
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    222
    Hey there,

    thanks for getting back to me, yeah i mean like fast forward and rewind (not to the beginning of the movie, but just move the movie backwards). I tried your code and it doesn't seem to work still. I wonder if I am missing something else :/ i will check out your library. I saw your XML video player, looks brilliant - is that the one you're referring too?

    Cheers!
    You have to think in Flash

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center