title: 1180: Call to a possibly undefined method arrays
body: <p>Greeting,
  I just started to learn scripting and am trying to make a memory game for a school project. I have been able to solve most of the issues myself but now I stumbled a ERROR i can't fix :/</p>
  
  <blockquote>
    <p>1180: Call to a possibly undefined method arrays on line 80, in the
    Function <code>setupGame()</code> the <code>cardValues = new arrays();</code></p>
  </blockquote>
  
  <pre><code>package {
  import flash.display.*;
  import flash.events.*;
  import flash.ui.*;
  
  public class Memory extends MovieClip
  {
      private var score, life:Number;
      private var doLoseLife, gotoWin, gotoLose:Boolean;
      private var firstCard, secondCard:Card;
      private var cardValues, cards:Array;
  
      public function Memory()
      {
  
      }
  
      //All Start Functions
      public function startMenu()
      {
          stop();
          btnStartGame.addEventListener(MouseEvent.CLICK, gotoStartGame);
          btnHowToPlay.addEventListener(MouseEvent.CLICK, gotoHowToPlay);
      }
  
      public function startHowToPlay()
      {
          btnBack.addEventListener(MouseEvent.CLICK, gotoMenu);
      }
  
      public function startWin()
      {
          btnBack.addEventListener(MouseEvent.CLICK, gotoMenu);
      }
  
      public function startLose()
      {
          btnBack.addEventListener(MouseEvent.CLICK, gotoMenu);
      }
  
      public function startGame()
      {           
          score = 0;
          life = 10;
          doLoseLife = false;
          gotoWin = false;
          gotoLose = false;
          firstCard = null;
          secondCard = null;
          cards = new Array();
  
          setupGame();
  
          //Shuffle
          cardValues = new Array();
          for (var i=0; i&lt;100; i++)
          {
              var swap1 = Math.floor(Math.random()*14);
              var swap2 = Math.floor(Math.random()*14);
  
              var tempValue = cardValues[swap1];
              cardValues[swap1] = cardValues[swap2];
              cardValues[swap2] = tempValue;  
          }
  
          //Deal
          for (var j=0; j&lt;cardValues.length; j++)
          {
              cards[j].hiddenValue = cardValues[j];
              cards[j].addEventListener(MouseEvent.CLICK, flipCard);
          }
  
          addEventListener(Event.ENTER_FRAME,update);
  
          stage.focus = this;
      }
  
      private function setupGame()
      {
          cardValues = new arrays();
          //Check the classes of the movieclips and push them into the 
          //appropriate arrays
          for (var i=0; i&lt; MovieClip(root).numChildren; i++)
          {
              var object = MovieClip(root).getChildAt(i);
  
              if (object is Card)
              {
                  cards.push(object);
              }
              cardValues.push("card"+(cardValues+length +1));
              var m = cardValues.length +1;
              cardValues.push("card"+m);
              cardValues.push("card"+m);
          }
      }
  
      private function gotoStartGame(evt:MouseEvent)
      {
          btnStartGame.removeEventListener(MouseEvent.CLICK, gotoStartGame);
          btnHowToPlay.removeEventListener(MouseEvent.CLICK, gotoHowToPlay);
          gotoAndStop("level1");
      }
  
      private function gotoHowToPlay(evt:MouseEvent)
      {
          btnStartGame.removeEventListener(MouseEvent.CLICK, gotoStartGame);
          btnHowToPlay.removeEventListener(MouseEvent.CLICK, gotoHowToPlay);
          gotoAndStop("howtoplay");
      }
  
      private function gotoMenu(evt:MouseEvent)
      {
          btnBack.removeEventListener(MouseEvent.CLICK, gotoMenu);
          gotoAndStop("menu");
      }
  
      private function flipCard(evt:MouseEvent)
      {
          if (firstCard == null)
          {
              firstCard = evt.currentTarget as Card;
              firstCard.gotoAndStop(firstCard.hiddenValue);
          }
          else if (secondCard == null)
          {
              if (firstCard == evt.currentTarget as Card)
                  return;
  
              secondCard = evt.currentTarget as Card;
              secondCard.gotoAndStop(secondCard.hiddenValue);
  
              doLoseLife = true;
          }
          else
          {
              //this is the third card clicked,
              //means the cards clicked do not match
              //reset them
              firstCard.gotoAndStop("back");
              secondCard.gotoAndStop("back");
              secondCard = null;
  
              firstCard = evt.currentTarget as Card;
              firstCard.gotoAndStop(firstCard.hiddenValue);
          }
      }
  
      public function update(evt:Event)
      {
          handleUserInput();
          handleGameLogic();
          handleDraw();
  
          if (gotoWin)
              triggerGoToWin();
          else if (gotoLose)
              triggerGoToLose();
      }
  
      private function handleUserInput()
      {
  
      }
  
      private function handleGameLogic()
      {
          if (firstCard != null &amp;&amp; secondCard != null)
          {
              //check if same
              if (firstCard.hiddenValue == secondCard.hiddenValue)
              {
                  removeChild(firstCard);
                  removeChild(secondCard);
  
                  score += 10;
  
                  firstCard = null;
                  secondCard = null;
              }
              else if (doLoseLife)
              {
                  life--; //considered as one attempt once both cards are flipped
                  doLoseLife = false;
              }
          }
  
          if (currentLabel == "level1")
          {
              if (score &gt;= 70)
              {
                  gotoAndStop("level2")
              }
          }
          else if (currentLabel == "level2")
          {
              if (score &gt;= 150)
              {
                  gotoAndStop("level3")
              }
          }
          else if (currentLabel == "level3")
          {
              if (score &gt;= 150)
              {
                  gotoWin = true;
              }
          }   
          if (life &lt;= 0)
          {
              gotoLose = true;
          }
      }
  
      private function handleDraw()
      {
          //Handle display
          txtScoreP1.text = String(score);
          txtLife.text = String(life);
      }
  
      private function triggerGoToWin()
      {
          removeEventListener(Event.ENTER_FRAME, update);
          gotoAndStop("win");
      }
  
      private function triggerGoToLose()
      {
          removeEventListener(Event.ENTER_FRAME, update);
          gotoAndStop("lose");
      }
  
      //Misc Functions
      private function resetGame()
      {
          for (var i in cards)
              cards[i].gotoAndStop("back");
      }       
    } 
  }
  </code></pre>