A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: go from one flv to another automatically???

  1. #1
    Senior Member
    Join Date
    Aug 2001
    Posts
    116

    go from one flv to another automatically???

    I have 3 videos at this site... the first one plays automatically.. is it possible to get the second one to play (which I guess would mean jumping to that frame) when the first flv is done playing? any help would be appreciated. Thanks.

    http://www.continentalrto.com/buywithoutdebt/

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Listen to the video player for a COMPLETE event - when you get that you can just spoof a click on the next button:
    PHP Code:
    var activeButton button1;

    vidPlayer.addEventListener(Event.COMPLETE, function(e:Event):void{
        switch(
    activeButton){
            case 
    button1:
                
    activeButton button2;
                
    button2.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
                break;
            case 
    button2:
                
    activeButton button3;
                
    button3.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
                break;
            case 
    button3:
            default:
                
    activeButton button1;
                
    button1.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
                break;
        }
    }); 

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    thanks a lot for the help! Any chance of a quick explanation of that code? why 3 buttons? I'm kind of new to as3... thanks!!!!!!

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Just looking at your three buttons on that link...if you've got those in an array you could just move through that or whatever .... basically you just need some way to trigger the next video and if you already have buttons set up you can just piggyback off the same code those are using.

  5. #5
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    so, in this :

    var activeButton = button1;

    button1 should be changed to the name of my button?

  6. #6
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    This might help you help me...

    This is what I have on frame 1
    Code:
    stop();
    
    vid2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler99);
    function mouseDownHandler99(event:MouseEvent):void {
        gotoAndStop(5);
    }
    
    vid3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler98);
    function mouseDownHandler98(event:MouseEvent):void {
        gotoAndStop(10);
    }
    This is what I have on frame 5
    Code:
    stop();
    
    vid1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler100);
    function mouseDownHandler100(event:MouseEvent):void {
        gotoAndStop(1);
    }
    
    vid3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler98);
    function mouseDownHandler101(event:MouseEvent):void {
        gotoAndStop(10);
    }
    This is what I have on frame 10
    Code:
    stop();
    
    vid1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler100);
    function mouseDownHandler102(event:MouseEvent):void {
        gotoAndStop(1);
    }
    
    vid2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler99);
    function mouseDownHandler103(event:MouseEvent):void {
        gotoAndStop(5);
    }

  7. #7
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    any chance anyone can help me with this... probably easy for the right person.. Thanks!!!

  8. #8
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    ok... please please help if you can!!!!! this is what I'm finding online.. but it's not quite working..

    Code:
    function complete(eventObject:Object):Void {
    	gotoAndStop(5);
    }
    my_FLVMOVIE.addEventListener("complete", this);
    stop();
    any ideas.....?????

  9. #9
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    figured this out on my own if anyone cares....

    named my movie player "vid"

    put this code on the same key frame as the video...

    Code:
    vid.addEventListener(Event.COMPLETE, completeHandler);
    
    function completeHandler(event:Event){
       gotoAndStop(5); 
    }
    Then my next video (which is on frame 5) I named "vid02" and put this code...

    Code:
    vid02.addEventListener(Event.COMPLETE, completeHandler2);
    
    function completeHandler2(event:Event){
       gotoAndStop(10); 
    }
    then my last video (on frame 10) I named "vid03" and made it jump back to the first video with this code:

    Code:
    vid03.addEventListener(Event.COMPLETE, completeHandler3);
    
    function completeHandler3(event:Event){
       gotoAndStop(1); 
    }
    Probably basic for most people.. but I'm glad I figured it out. If you're new like me... just remember your completeHandler has to have a different name each time... like completeHandler1, completeHandler2, etc..... anyway.. thanks to anyone who was going to help me.

  10. #10
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    I thought I figured this out... it pretty much works... but if you click thru the 3 movie buttons fast, or chaotically.... they go nuts.. and never get back on track. They just keep jumping around... you can see here: http://www.continentalrto.com/buywithoutdebt/ any ideas how to prevent this???? Please help!!!! This is extremely time sensitive, and I'm losing my mind!!! Thanks!

  11. #11
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    When you click quickly you're opening a bunch of videos at once and then navigating away - but those net streams are still coming in and when they complete it fires your onComplete for each of those...Try removing the eventHandlers and closing the video...something like this:

    PHP Code:
    vid.closeVideoPlayer(0);
    vid.removeEventListener(Event.COMPLETEcompleteHandler); 

  12. #12
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    Thanks for your reply. I've tried that in a couple spots, but it's giving me errors.. can you tell me where I should put it? this is the code on frame 5 for example:

    Code:
    vid02.addEventListener(Event.COMPLETE, completeHandler2);
    
    function completeHandler2(event:Event){
       gotoAndStop(10); 
    }
    should it go above the top line? or above the gotoAndStop line? Also, I would put this:

    Code:
    vid.closeVideoPlayer(0);
    vid.removeEventListener(Event.COMPLETE, completeHandler);
    in this frame correct? I don't want to put this:

    Code:
    vid02.closeVideoPlayer(0);
    vid02.removeEventListener(Event.COMPLETE, completeHandler);
    because I can't delete what's playing... the point is to close or remove the vid that the timeline just left... correct? or am I missing the point? Thanks again!

  13. #13
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    You want to fire that code when you click off to a new frame so it should probably be in your buttons' handler - and you'll want to target the video player that's currently on stage at that moment.

  14. #14
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    [PHP]I was thinking the same thing after I asked that question... but I'm getting this error...

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at home_fla::MainTimeline/mouseDownHandler99()

    this is my button code on frame one.. (button names are vid1, vid2, vid3 respectively..

    PHP Code:
    stop();
    SoundMixer.stopAll();
    vid2.addEventListener(MouseEvent.MOUSE_DOWNmouseDownHandler99);
    function 
    mouseDownHandler99(event:MouseEvent):void {
        
    gotoAndStop(5);
        
    vid.closeVideoPlayer(0);
        
    vid.removeEventListener(Event.COMPLETEcompleteHandler);
    }

    vid3.addEventListener(MouseEvent.MOUSE_DOWNmouseDownHandler98);
    function 
    mouseDownHandler98(event:MouseEvent):void {
        
    gotoAndStop(10);
        
    vid.closeVideoPlayer(0);
        
    vid.removeEventListener(Event.COMPLETEcompleteHandler);

    any ideas?

  15. #15
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    so in your mouseDownHandler99 function (99 - ?!) you need to make sure that's getting called when vid is on stage - if not you can use an if-then to trap it:

    PHP Code:
    if(vid){
      
    vid.removeEventHandler...


  16. #16
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    this code is in frame 1... and vid is in frame 1. it's on the stage when I press button vid2 or button vid3. Shouldn't have to trap it... not that I would know how to do that anyway.. but if vid is playing.. while I'm pushing the button... it's on the stage, correct?

  17. #17
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Yeah - but since your code is an event handler you have to remember that it's getting handled the frame after the event - so if your playhead is moving in that time, things can get offset...

  18. #18
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    If you're still having trouble can you post all the code in the frame or a copy of your fla?

  19. #19
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    ok... so I'm learning a lot.. but I still don't really know what I'm doing... is this even close? I don't know what to put for "else"... ?

    PHP Code:
    if(vid){
        
    vid.closeVideoPlayer(0);
        
    vid.removeEventListener(Event.COMPLETEcompleteHandler);
    }
    else
    {
    how do I say do nothing... 


  20. #20
    Senior Member
    Join Date
    Aug 2001
    Posts
    116
    can you download it from here? www.kalcotter.com/continental/home.fla

    it's too big to upload.... I'm sure it's not the most "efficient" file... thanks!

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