A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: MediaPlayback as1 listener

  1. #1
    Senior Member
    Join Date
    Mar 2001
    Posts
    197

    MediaPlayback as1 listener

    I’m in flash 8, using the MediaPlayback component. My question is about setting up an actionscript 1 listener.

    I’m trying to detect the end of an flv, then fire off some actions. (loadMovie, etc.) But so far I have not had any success getting a listener to work.

    Does anybody know how to setup as1 listener that will detect the end of a flv file, through the MediaPlayback component?

    Thanks in advance…

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    This is what I do:

    Code:
    myNetconnection = new NetConnection();
    myNetconnection.connect(null);
    myStream = new NetStream(myNetconnection);
    myStream.setBufferTime(3);
    my_video.attachVideo(myStream);
    myStream.play(my.flv);
    Code:
     myStream.onStatus = function(info)
    {
    trace("info="+info.code);
    if (info.code == "NetStream.Play.Stop")
    {
    // Set flag, we will need to wait for
    // "NetStream.Buffer.Empty" before
    // actually restarting the movie.
    stopped=true;
    }
    if (info.code == "NetStream.Buffer.Empty")
    {
    // At this point, the movie has stopped, and
    // the buffer is empty.
    // We're ready to restart the movie.
    if (stopped)
    {
    myStream.seek(0)
    myStream.play(my.flv);
    stopped=false;
    }
    }
    }

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