# IF statement help

**URL:** <https://forum.kirupa.com/t/if-statement-help/301049>\
**Category:** flash\
**Created:** [December 2, 2009, 9:21pm UTC](https://forum.kirupa.com/t/if-statement-help/301049 "2009-12-02T21:21:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmmdonuts](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@mmmdonuts](https://forum.kirupa.com/u/mmmdonuts)\
**Post date:** [December 2, 2009, 9:21pm UTC](https://forum.kirupa.com/t/if-statement-help/301049/1 "2009-12-02T21:21:58Z")

</div>

Okay, I am making a SWF in which there are 4 plain eggs. When you click on an egg an animation will “paint” them for Easter.

The trouble I am having is this: I want to have the file jump to a specific frame after all four eggs have been clicked and all 4 animations have played through.

In each of the movie clips (which paint a pattern onto the egg) i have put a stop(); on the last frame, frame 7.

Each egg (tan, lime, blue, pink) has a button (tanBtn, limeBtm, blueBtn, pinkBtn) and each movieclip is named accordingly (tanPattern, limePattern, bluePattern, pinkPattern).

Here is the script I have on the main stage, frame 1:

this.stop();  
tanPattern.stop();  
limePattern.stop();  
bluePattern.stop();  
pinkPattern.stop();

tanBtn.addEventListener(MouseEvent.CLICK, tanPaint)

function tanPaint(event:MouseEvent) {  
tanPattern.play();  
}

limeBtn.addEventListener(MouseEvent.CLICK, limePaint)

function limePaint(event:MouseEvent) {  
limePattern.play();  
}

blueBtn.addEventListener(MouseEvent.CLICK, bluePaint)

function bluePaint(event:MouseEvent) {  
bluePattern.play();  
}

pinkBtn.addEventListener(MouseEvent.CLICK, pinkPaint)

function pinkPaint(event:MouseEvent) {  
pinkPattern.play();  
}

if (tanPattern.currentFrame==7&&limePattern.currentFrame==7&&bluePattern.currentFrame==7&&pinkPattern.currentFrame==7) {  
gotoAndStop(8);  
}  
}

* * *

however it’s not working like it should. the if statement is not running when they movie clips are finished playing… i think because it is on frame 1 and when it runs not all the movie clips will ever be at frame 7.

any help is appreciated!!
