A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: video control

  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    96

    video control

    I obtained the below code from gotoandlearn.com on how to load flv files. I was wondering if anyone could show me how I would jump to a new frame after the flv finishes playing. Is this something I would use a cue point for?

    Thanks very much in advance!

    Code:
    stop();
    var video:Video = new Video(1000, 750);
    addChild(video);
    
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    
    var ns:NetStream = new NetStream(nc);
    ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
    
    function onStatusEvent(stat:Object):void
    {
    	trace(stat.info.code);
    }
    
    
    var meta:Object = new Object();
    meta.onMetaData = function(meta:Object)
    {
    	trace(meta.duration);
    }
    
    ns.client = meta;
    
    video.attachNetStream(ns);
    
    ns.play("ReaganMotion.flv");

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You have several options. You can use the stat.info.code, when the player stops.
    if(stat.info.code==""NetStream.Play.Stop")
    {
    gotoAndPlay("wherever");
    }

    You can use meta data when the movie finishes.
    if(ns.time>=meta.duration)
    {
    gotoAndPlay("wherever");
    }


    This is when the playhead has reached the end. Just make sure that the number dimensions are the same since I am not sure.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Nov 2005
    Posts
    96
    for some reason I cant get either to work...the top version has something wrong with the quotes.

    Is there a particular place i need to insert the if statement, or can i just drop it below everything?

    Thanks very much!

  4. #4
    Member
    Join Date
    Nov 2005
    Posts
    96
    This solved my issue!

    Thanks for a great start!!!

    PHP Code:
    ns.addEventListener(NetStatusEvent.NET_STATUSnetstat);

    function 
    netstat(stats:NetStatusEvent)
    {
            
    trace(stats.info.code);
          if (
    stats.info.code =="NetStream.Play.Stop")
          {
              
    gotoAndStop"home" "Scene 1");
          }


  5. #5
    Member
    Join Date
    Nov 2005
    Posts
    96
    hello again...

    So i just can't seem to get this bad boy to buffer! Any ideas for the above video loader?

    Thanx

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Have you tried ns.bufferTime?
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Member
    Join Date
    Nov 2005
    Posts
    96
    thats it...

    ns.bufferTime = 5;

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