Skip navigation
reichert2012
Currently Being Moderated

Control Movieclip symbol from main time line.

Dec 8, 2012 7:45 AM

Tags: #start #line #video #stop #time #movie #clip #control #main #movieclip()

I am new to AS3. So what I have done is create 3 buttons on the main timeline, each button will goto a framelabel/keyframe. This all works, however in that keyframe I have a movie symbol with an FLV video embedded in it. I want to hit a button on the main timeline, goto that keyframe and the movie plays. So far this works, the problem is I want to stop the movie when I slect a different button. If I select a differnt button the movie keeps playing and if I hit that same but and go back t the movie, then the movie starts playing and I have 2 instances playing at the same time. I tried to search here, but I can't seem to find anything like what I am doing.Untitled-2.jpg

So here is the main timeline, I have 3 buttons on the menu layer, and separte content on each of the 3 frames at the label points.

Untitled-3.jpg

As you can see I have a flv video embedded into a symbol (type Movie Clip), so when I select button 2 it goes and plays the movie, however when I select either button 1 or 3 to change the placement, the movie keeps playing in the background, (I can hear the audio), was hoping someone can tell me how to add code to stop this when I select a different button Below is my code I have now,

Untitled-4.jpgUntitled-5.jpg

Here you can see that the video is embedded in the movieclip. I am doing this because I want to have only 1 file, I do not want an external file. I am trying to create a mobile app, so want only 1 file.

 

Any help help is greatly appriciated.

 
Replies
  • kglad
    72,188 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 8, 2012 7:51 AM   in reply to reichert2012

    use an Event.REMOVE_FROM_STAGE listener attached to your flvplayback instance to stop the play, if you're using an flvplayback component.

     
    |
    Mark as:
  • kglad
    72,188 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 8, 2012 9:16 AM   in reply to reichert2012

    then you can just stop the movieclip timeline that contains the embedded video:

     

    your_mc.addEventListener(Event.REMOVED_FROM_STAGE,f);

    function f(e:Event):void{

    your_mc.stop();

    }

     
    |
    Mark as:
  • kglad
    72,188 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 8, 2012 9:58 AM   in reply to reichert2012

    use:

     

     

    stop();

      var dot:Dot;

    btn_page1.addEventListener(MouseEvent.CLICK, onPage1);
    btn_page2.addEventListener(MouseEvent.CLICK, onPage2);
    btn_page3.addEventListener(MouseEvent.CLICK, onPage3);

    function onPage1(event:MouseEvent):void
    {

    removedotF();

      gotoAndStop("page1");
    }
    function onPage2(event:MouseEvent):void
    {
      gotoAndStop("page2");
    dot= new Dot;

      addChild(dot);
       dot.x=10;
       dot.y=10;
    }

    function removedotF():void{

    if(dot){

    dot.stop();

    removeChild(dot);

    dot=null

    }

    }

    function onPage3(event:MouseEvent):void
    {

    removedotF();

      gotoAndStop("page3");
    }

     

    p.s.  please mark helpful/correct responses.

     
    |
    Mark as:
  • kglad
    72,188 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 8, 2012 10:11 AM   in reply to reichert2012

    you're welcome.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points