A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] video won't stop

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    32

    resolved [RESOLVED] video won't stop

    I have a website that plays video1 when it opens. When you navigate to next page the video stops. One of the buttons on the second page plays video2. The problem is that video 2 won't stop using the same command that made video1 stop.

    Thanks to anyone who can help me out.
    D

    here is the code for the home page:
    var vid:Video = new Video();
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var netStream:NetStream = new NetStream(nc);

    netStream.close();
    vid.visible=false;

    netStream.addEventListener(NetStatusEvent.NET_STAT US, ns_onPlayStatus);
    addChild(vid);
    vid.attachNetStream(netStream);
    netStream.bufferTime=3;

    netStream.play("video1.flv");
    vid.visible=true;
    vid.width=665;
    vid.height=500;
    vid.x=40;
    vid.y=180;

    here is the code for page 2:

    netStream.close();
    vid.visible=false;

    bInside.addEventListener(MouseEvent.CLICK, video2);
    function video2(event:MouseEvent):void {
    mcRates.stop();
    mcActivities.stop();
    mcMap.stop();

    mcRates.visible=false;
    mcActivities.visible=false;
    mcMap.visible=false;

    nc.connect(null);
    netStream.play("video2.flv");
    vid.visible=true;
    vid.width=480;
    vid.height=360;
    vid.x=250;
    vid.y=240;
    }

    bRates.addEventListener(MouseEvent.CLICK, rates);
    function rates(event:MouseEvent):void {
    mcRates.play();

    mcActivities.stop();
    mcMap.stop();

    netStream.close();
    vid.visible=false;

    mcRates.visible=true;
    mcActivities.visible=false;
    mcMap.visible=false;

    }

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I think the reason is that when you go back from video2 to video1 you create the video object, the Netconnection and Netstream newly again. One possibility could be when you use frames (which is bad when using AS) that you load separate movies containing the videos into the same loader.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    32
    I think you may be right. I fixed the problem by putting the stop command in the home button.

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