A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: detect when video is finished and stop, instead of looping

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    detect when video is finished and stop, instead of looping

    Hi,
    I am using a video player from lee brimelow with some modifications

    I have this code to setup the netstream and start the video
    Code:
    var ns:NetStream = new NetStream(nc);
    ns.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
    ns.client = this;
    video.attachNetStream(ns);
    
    ns.play("NTSC progressive_jan18_2009_1 554x295_1_2.f4v");
    right now my video loops, I want it to stop at the end
    how do I do that?

    thanks
    mark

  2. #2
    Junior Member
    Join Date
    Feb 2009
    Posts
    8
    stop();

    is your friend.

    Use him wisely and whenever u can.

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    resolved

    ah yes
    but stopping at the END was the issue, knowing when the end was reached.

    In the end I decided to rewind and stop at the beginning.
    For anyone who is interested the video player which Lee Brimelow designed for flasher magazine is available for free download on his blog, on condition you change the appearance of the interface. http://theflashblog.com

    in case anyone else uses it, to solve my problem look for this code about e.info.code. this worked for me.
    PHP Code:
        else if(e.info.code == "NetStream.Play.Stop") {
            
    ns.seek(0);
            
    ns.pause();
            empty.
    visible false;
        } 
    to send different movies to the player I simply have my movie stop on the frame after the player code. I set the flv name up as a variable. When I need a new movie the button sends the movie back to the previous frame with a new flv name.

    mark

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