# Help simplify this code

**URL:** <https://forum.kirupa.com/t/help-simplify-this-code/267167>\
**Category:** Uncategorized\
**Created:** [July 29, 2008, 10:49am UTC](https://forum.kirupa.com/t/help-simplify-this-code/267167 "2008-07-29T10:49:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![540media](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/540media/32/2543_2.png) [@540media](https://forum.kirupa.com/u/540media)\
**Post date:** [July 29, 2008, 10:49am UTC](https://forum.kirupa.com/t/help-simplify-this-code/267167/1 "2008-07-29T10:49:21Z")

</div>

could someone help me simplify this code down a bit  
it works just fine as it is, but I would like it to be smaller and more compact if possible

whatever I do I cant get it to work unless its in a mass of if statements

```auto
onEnterFrame = function(){
 for (var i=0; i < 14; i++){
  if (cardsArray[0] == i){
   this["cross" + i]._alpha = 100;
  }
 }
 
 ////////////////////////Card 1 Guess////////////////////////
 if (_global.goCounter == 1){
  if (cardsArray[1] > cardsArray[0] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack1._alpha = 0;
   trace("card"+cardsArray[1]);
  }
 
  if (cardsArray[1] < cardsArray[0] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack1._alpha = 0;
   trace("card"+cardsArray[1]);
  }
 
  if (cardsArray[1] < cardsArray[0] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack1._alpha = 0;
   trace("card"+cardsArray[1]);
  }
 
  if (cardsArray[1] > cardsArray[0] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack1._alpha = 0;
   trace("card"+cardsArray[1]);
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[1] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 2 Guess////////////////////////
 if (_global.goCounter == 2){
  if (cardsArray[2] > cardsArray[1] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack2._alpha = 0;
  }
 
  if (cardsArray[2] < cardsArray[1] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack2._alpha = 0;
  }
 
  if (cardsArray[2] < cardsArray[1] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack2._alpha = 0;
  }
 
  if (cardsArray[2] > cardsArray[1] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack2._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[2] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 3 Guess////////////////////////
 if (_global.goCounter == 3){
  if (cardsArray[3] > cardsArray[2] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack3._alpha = 0;
  }
 
  if (cardsArray[3] < cardsArray[2] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack3._alpha = 0;
  }
 
  if (cardsArray[3] < cardsArray[2] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack3._alpha = 0;
  }
 
  if (cardsArray[3] > cardsArray[2] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack3._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[3] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 4 Guess////////////////////////
 if (_global.goCounter == 4){
  if (cardsArray[4] > cardsArray[3] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack4._alpha = 0;
  }
 
  if (cardsArray[4] < cardsArray[3] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack4._alpha = 0;
  }
 
  if (cardsArray[4] < cardsArray[3] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack4._alpha = 0;
  }
 
  if (cardsArray[4] > cardsArray[3] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack4._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[4] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 5 Guess////////////////////////
 if (_global.goCounter == 5){
  if (cardsArray[5] > cardsArray[4] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack5._alpha = 0;
  }
 
  if (cardsArray[5] < cardsArray[4] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack5._alpha = 0;
  }
 
  if (cardsArray[5] < cardsArray[4] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack5._alpha = 0;
  }
 
  if (cardsArray[5] > cardsArray[4] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack5._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[5] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 6 Guess////////////////////////
 if (_global.goCounter == 6){
  if (cardsArray[6] > cardsArray[5] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack6._alpha = 0;
  }
 
  if (cardsArray[6] < cardsArray[5] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack6._alpha = 0;
  }
 
  if (cardsArray[6] < cardsArray[5] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack6._alpha = 0;
  }
 
  if (cardsArray[6] > cardsArray[5] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack6._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[6] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 7 Guess////////////////////////
 if (_global.goCounter == 7){
  if (cardsArray[7] > cardsArray[6] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack7._alpha = 0;
  }
 
  if (cardsArray[7] < cardsArray[6] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack7._alpha = 0;
  }
 
  if (cardsArray[7] < cardsArray[6] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack7._alpha = 0;
  }
 
  if (cardsArray[7] > cardsArray[6] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack7._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[7] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 8 Guess////////////////////////
 if (_global.goCounter == 8){
  if (cardsArray[8] > cardsArray[7] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack8._alpha = 0;
  }
 
  if (cardsArray[8] < cardsArray[7] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack8._alpha = 0;
  }
 
  if (cardsArray[8] < cardsArray[7] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack8._alpha = 0;
  }
 
  if (cardsArray[8] > cardsArray[7] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack8._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[8] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 9 Guess////////////////////////
 if (_global.goCounter == 9){
  if (cardsArray[9] > cardsArray[8] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack9._alpha = 0;
  }
 
  if (cardsArray[9] < cardsArray[8] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack9._alpha = 0;
  }
 
  if (cardsArray[9] < cardsArray[8] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack9._alpha = 0;
  }
 
  if (cardsArray[9] > cardsArray[8] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack9._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[9] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 10 Guess////////////////////////
 if (_global.goCounter == 10){
  if (cardsArray[10] > cardsArray[9] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack10._alpha = 0;
  }
 
  if (cardsArray[10] < cardsArray[9] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack10._alpha = 0;
  }
 
  if (cardsArray[10] < cardsArray[9] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack10._alpha = 0;
  }
 
  if (cardsArray[10] > cardsArray[9] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack10._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[10] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 11 Guess////////////////////////
 if (_global.goCounter == 11){
  if (cardsArray[11] > cardsArray[10] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack11._alpha = 0;
  }
 
  if (cardsArray[11] < cardsArray[10] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack11._alpha = 0;
  }
 
  if (cardsArray[11] < cardsArray[10] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack11._alpha = 0;
  }
 
  if (cardsArray[11] > cardsArray[10] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack11._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[11] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 ////////////////////////Card 12 Guess////////////////////////
 if (_global.goCounter == 12){
  if (cardsArray[12] > cardsArray[11] && _global.hlPress == 1){
   scoring.gotoAndPlay(2);
   cardBack12._alpha = 0;
  }
 
  if (cardsArray[12] < cardsArray[11] && _global.hlPress == 1){
   scoring.gotoAndPlay(3);
   cardBack12._alpha = 0;
  }
 
  if (cardsArray[12] < cardsArray[11] && _global.hlPress == 2){
   scoring.gotoAndPlay(2);
   cardBack12._alpha = 0;
  }
 
  if (cardsArray[12] > cardsArray[11] && _global.hlPress == 2){
   scoring.gotoAndPlay(3);
   cardBack12._alpha = 0;
  }
 
  for (var i=0; i < 14; i++){
   if (cardsArray[12] == i){
    this["cross" + i]._alpha = 100;
   }
  }
 }
 /////////////////////////////////////////////////////////////
 
 
 
}

```
