# Time-delay in memory game

**URL:** <https://forum.kirupa.com/t/time-delay-in-memory-game/330491>\
**Category:** flash\
**Created:** [January 29, 2013, 9:55am UTC](https://forum.kirupa.com/t/time-delay-in-memory-game/330491 "2013-01-29T09:55:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_van\_gijzen](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@m\_van\_gijzen](https://forum.kirupa.com/u/m_van_gijzen)\
**Post date:** [January 29, 2013, 9:55am UTC](https://forum.kirupa.com/t/time-delay-in-memory-game/330491/1 "2013-01-29T09:55:20Z")

</div>

[SIZE=2]Hi,  
I’m building a memory game and am trying to build in a delay, a pause before a matching pair of cards is removed. I have tried almost every option given in any other post on this site but I can’t figure it out. I tried a simple “for” statement, timer events etc. but nothing works. Best case I get no compiler-errors and there simply happens…nothing. Can anybody please help me! Thx!!! This is the code I use:

I case you wonder what strange language it is, it’s Dutch and now I know why I shouldn’t have done that! 🙂

\*// player clicks a card  
public function klik\_kaart(event:MouseEvent) {  
var deze\_kaart:Kaart\_1 = (event.currentTarget as Kaart\_1); // wich card?

if (eerste\_kaart == null) { // first card  
eerste\_kaart = deze\_kaart; // define the first card  
eerste\_kaart.gotoAndStop(deze\_kaart.voorkant+2); // turn around first card

} else if (eerste\_kaart == deze\_kaart) {// first card is clicked again  
eerste\_kaart.gotoAndStop(23); // turn back the first card  
eerste\_kaart = null;

} else if (tweede\_kaart == null) { // define the second card  
tweede\_kaart = deze\_kaart; // this is the second card  
tweede\_kaart.gotoAndStop(deze\_kaart.voorkant+2); // turn around second card

// compare the two cards  
if (Math.floor(eerste\_kaart.voorkant/2) == Math.floor(tweede\_kaart.voorkant/2)) {

// remove a matching pair  
removeChild(eerste\_kaart)  
removeChild(tweede\_kaart)

// reset first card and second card to “null”.  
eerste\_kaart = null;  
tweede\_kaart = null;\*

Greats, Marco.[/SIZE]
