dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: VideoEvent.COMPLETE problems

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    373

    VideoEvent.COMPLETE problems

    Got a video object and on it I want a play button to appear after the video is completed ala YouTube. Tried the following code but got a 1046: Type was not found error instead. Here's my code:
    --
    import fl.video.VideoEvent;
    stop();
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    myVid.attachNetStream(ns);
    var listener:Object = new Object();
    listener.onMetaData = function(md:Object):void {};
    ns.client = listener;
    play_btn.addEventListener(MouseEvent.CLICK, playVideo);
    function playVideo(evt:MouseEvent):void {
    play_btn.visible = false;
    ns.play("video.flv");
    }
    myVid.addEventListener(fl.video.VideoEvent.COMPLET E, playAgain);
    function playAgain(v:VideoEvent){
    play_btn.visible = true;
    }
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    have you imported the netstream and netconnection class?

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    plus, why are you making a listener when there is the addEventListener function?

    you may also need to import the
    Code:
     fl.video.MetadataEvent;
    class.
    Dan

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    Well, that's what I'm trying to figure out. Do I need that extra listener? Or place the NetStream.Play.Complete inside of the same function?
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  5. #5
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    ah - whoops.

    looks like you do need that extra metadata listener other wise the app crashes. damn.

    if I'm using the flvplayback component (which you could do if size is no object) then I just listen for videoEvent.COMPLETE and feed it an appropriate handler.

    Dan

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    Well, I'd like to learn how to use it with the NetStream object instead of bringing in the larger FLV Playback Component.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  7. #7
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    aha! ultrashock to the rescue once more:

    http://www.ultrashock.com/forums/act...nts-92078.html

    or you could try actionscript.org:

    http://www.actionscript.org/forums/s....php3?t=142755

    does that help?
    Dan

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    The actionscript.org link did it for me. Thanks for the links.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  9. #9
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    Excellent, glad I could "help"....

    Dan

Tags for this Thread

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