# Conditional loops not working in an as3 game

**URL:** <https://forum.kirupa.com/t/conditional-loops-not-working-in-an-as3-game/277446>\
**Category:** Uncategorized\
**Created:** [December 12, 2008, 3:01am UTC](https://forum.kirupa.com/t/conditional-loops-not-working-in-an-as3-game/277446 "2008-12-12T03:01:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icebot](https://avatars.discourse-cdn.com/v4/letter/i/8491ac/32.png) [@icebot](https://forum.kirupa.com/u/icebot)\
**Post date:** [December 12, 2008, 3:01am UTC](https://forum.kirupa.com/t/conditional-loops-not-working-in-an-as3-game/277446/1 "2008-12-12T03:01:48Z")

</div>

Hi,

i madly trying to finish a final project for a class i’m taking, and i got hung up on the ‘matching’ part of my matching game.

code for card.as looks like this:

```
public function flip(evt:MouseEvent = null):void {
    
    var thisCard = evt.target;
    
    TweenMax.to(this, 1, {scaleX:0, ease:Quad.easeInOut});
    TweenFilterLite.to(this, 1, {blurFilter:{blurX:5}}); 
    TweenFilterLite.from(this, 1, {blurFilter:{blurX:0}});     
    TweenMax.to(this, 1, {scaleX:1, ease:Quad.easeInOut, delay:1});
    
    if (firstCard == null) {
        
        firstCard = thisCard;
        TweenMax.to(image, 0.5, {alpha:1, ease:Quad.easeInOut, delay:1});
        trace(this.cardFace);
        flipped = true;
        }    
        
    else if (firstCard == thisCard) {

        TweenMax.to(image, 0.5, {alpha:0, ease:Quad.easeInOut, delay:1});
        flipped = false;
        firstCard = null;
        
    }
    
    else if (secondCard == null) {
        
        secondCard = thisCard;
        TweenMax.to(image, 0.5, {alpha:1, ease:Quad.easeInOut, delay:1});
        flipped = true;
    
        if (firstCard == secondCard) {
        
            removeChild(firstCard);
            removeChild(secondCard);
            trace(firstCard);
            trace(secondCard);                
            firstCard = null;
            secondCard = null;
        
        }
        
    }

```

i can trace cardFace so that the trace returns the letter i need to match, but i’m having trouble getting it to do what i want.

any ideas?

i have other stuff going on in my document class…i can zip both files up to show what i’m doing.
