A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Display 'buffer' movieclip on FLV change

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    140

    [F8] Display 'buffer' movieclip on FLV change

    Hi,
    I'm currently working on a project displaying multiple FLV's through a video component using the netConnection/netStream method.
    Whilst the FLV is being progressively downloaded I use the NetStream.buffer parameters to check the netsream status and display a movieclip containing a 'buffering' message via bufferclip._visible=
    This code was obtained from Lee Brimelow's gotoandlearn tutorials, and works for my first FLV, however, once a new FLV has been selected and the netStream path has been updated, the playback is still paused for the allocated period but the bufferClip fails to appear again, instead the video just sits on the first frame until a sufficient amount has been downloaded.
    I can't work out why this is..
    My code is as follows:

    //------- SETUP NETSTREAM/CONTROLLER FUNCTIONS/LOADING BAR/SCRUB/TXT -----------

    var connection_nc:NetConnection = new NetConnection();
    connection_nc.connect(null);
    var stream_ns:NetStream = new NetStream(connection_nc);

    stream_ns.setBufferTime(7);

    stream_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);
    }
    }

    my_video.attachVideo(stream_ns);
    stream_ns.play("http://www.dedicatedmicros.com/ukftp/FLVHUB/FLV/1.FLV");

    //------- DYNAMIC FLV/BUTTON CODE --------------------
    applyButtonCode()
    //
    function applyButtonCode() {
    //use a for loop to reduce repetition of the code
    for(i=1;i<80;i++){
    theButton=_root.scrollerMC.thumbscroll["vid"+i];
    //this variable stores what number button it is
    theButton.thisNum=i;

    theButton.onRelease = function() {

    //set stream
    stream_ns.play("http://www.dedicatedmicros.com/ukftp/FLVHUB/FLV/"+this.thisNum+".FLV");
    };
    }


    controllerMC.rewindBTN.onRelease = function() {
    stream_ns.seek(0);
    }
    }
    Any ideas?

    Thanks,
    Dave

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    if ur watching an flv and then click to change it while its playing..the buffer is not being reset to visible..

    So to get over this do:

    Code:
    theButton.onRelease = function() {t
    stream_ns.play("http://www.dedicatedmicros.com/ukftp/FLVHUB/FLV/"+this.thisNum+".FLV");
    bufferClip._visible = true;
    };
    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
    Jun 2001
    Posts
    140
    It's amazing how stupid I can be some times..
    I've looked at that code so many times and never even realised.
    Thanks a lot!

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