How can I stop a movie (from current frame) playing when I click on next frame - FLASH CS4?

Posted by ladygeekgeek on Stack Overflow See other posts from Stack Overflow or by ladygeekgeek
Published on 2010-04-08T19:18:47Z Indexed on 2010/04/09 6:43 UTC
Read the original article Hit count: 262

Filed under:
|

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

}

© Stack Overflow or respective owner

Related posts about flash-cs4

Related posts about actionscript-3