Flash Memory/Match Game needs counter to end game

Please help, I have a Flash Memory Game completed.
There are 36 cards face down, 18 pairs are to be found.
you click the cards and upon matching - the cards go away.
Game works great, but I need to install a way to let the game know when 18 matches have been made…thus ending the game with a ‘You Win’ message.
I can not figure out how to tell the game the 18 matches have been made.
Any suggestions would be greatly appreciated!
Thanks so much!

How did you construct your engine?

If you have a (matched/unmatched) variables unique to each card, you can have the counter check the values of the variables on each frame using &&. If the check registers true, the win sequence will commence.

so…

onClipEvent (enterFrame){
if ((_global.match1==0)&&(_global.match2==0)&&(_global.match3==0)){
_root.counter.stop();
_root.victory.play();
}
}