views:

273

answers:

1

I have four movie clips (.f4v) in 4 frames in a movie with watch buttons.. This movie has them been imported into a main movie container that has next and previous buttons. However if i play a movie then hit next frame, the movie continues to play in the background. How can I shop this? The code below shows one of the actionscripts for a movie clip and then the main actionscript in the main movie. I am a flash newbie, so all help appreciated. Many thanks.

stop();

watch1_btn.addEventListener(MouseEvent.CLICK, playMovie1);

function playMovie1(event:MouseEvent):void { movie1_mc.play(); }

// Button Listeners next_btn.addEventListener(MouseEvent.CLICK, nextSection); prev_btn.addEventListener(MouseEvent.CLICK, prevSection);

function nextSection(event:MouseEvent):void {

var thisLabel:String = pages_mc.currentLabel; // gets current frame label as string
var thisLabelNum:String = thisLabel.replace("sct", ""); // cuts the leading letters off of the number
var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number
if (curNumber < 5) {

    var nextNum:Number = curNumber + 1; // adds 1 to the number so we can go to next frame label
    pages_mc.gotoAndStop("sct" + nextNum); // This allows us to go to the next frame label
    }

}

/////////////////////////////////////////////////////////////////////////// function prevSection(event:MouseEvent):void {

var thisLabel:String = pages_mc.currentLabel; // gets current frame label as string
var thisLabelNum:String = thisLabel.replace("sct", ""); // cuts the leading letters off of the number
var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number
var prevNum:Number = curNumber - 1; // subtracts 1 from the number so we can go to next frame label
pages_mc.gotoAndStop("sct" + prevNum); // This allows us to go to the previous frame label

}

A: 

just before the gotoAndStop() function, just put in a movie1_mc.stop(); command, this will stop the clip before changing the frame.

just on a developmental side of things, if you are only changing the video think about using just the one frame and adding/taking away the video from the stage using addChild() and removeChild(). things are usually so much easier to control overall getting around frames like this and is a good tool to learn.

shortstick
Thanks a million! I'll definitely look into the addChild functions.
ladygeekgeek