title: Storing multiple numbers in an array (As3)
body: <pre><code>        private var hitArray:Array = new Array [ 10, 20, 30, 40, 50, 60]; 
  </code></pre>
  
  <p>Hello. </p>
  
  <p>I have stored multiple numbers in an array and it appears flash does not like this, I am guessing that I am telling the array that it will either have 10 spaces, 20 spaces, etc...or the array needs to understand what variable it is datatyped to. </p>
  
  <p>so my next idea was to store a hundred numbers into the array by using this</p>
  
  <pre><code>    private var hitArray:Array = new Array; 
  
  
  
      public function Main() 
      {
          for (var i:int = 0; 0 &lt; 100; i++)
          {
              hitArray.push(i);
          }
  
  
  
          //iniaite health
          hitCounter = 0;
          resetPos = new Point(x, y);
          //iniation players
          _character = new player();
          timmy = new SirTimmy();
          caroline = new princess();
          goblinCanMove = true;
  
  
  
  
  
  
          stage.addEventListener(Event.ENTER_FRAME, mainGameLoop)
  
      }
  </code></pre>
  
  <p>By doing this, I would be able to achieve a greater method of hitTestPoint!</p>
  
  <pre><code>    private function enemyCollisionGoblin():void
      {
  
          //trace(aKnifeArray.length);
  
          //knive proccess
          for (var o:int = 0; o &lt; aKnifeArray.length; o++)
          {
              var currentKnife:Knife= aKnifeArray[o];
              if (currentKnife.x &lt; 0)
              {
                  //trace ('backmissile gone lol');
                  aKnifeArray.splice(o, 1);
                  currentKnife.removeKnife();
              }
  
  
              //if (_character.x &lt; redGoblin.x &amp;&amp; _character.x &gt; redGoblin.x - 600)
  
              for (var p:int = 0; p &lt; hitArray.length; p++)
              {
                  var number:Number = hitArray[p];
  
  
                  if (currentKnife.hitTestPoint(_character.x + number, _character.y - number, true)) //|| currentKnife.hitTestPoint(_character.x - 50, _character.y - 60, true))
                  {
                      trace("hit");
                  }
              }
          }
      }
  </code></pre>
  
  <p>The problem I am facing is that flash does not like the for loop in the main constructor, despite it being initiated one. </p>
  
  <p>It should break out of the for Loop if variable i is more than 100, but does not. </p>
  
  <p>My question it, how can I store numbers in an array, so I can use that array in my hit Test Point.</p>
  
  <p>Sorry, I know this is simple, but I'm currently developing and learning!</p>
  
  <p>Advice will be appreciate very much! </p>