title: ActionScript 3 if condition error
body: <p>I have the following code in my game:</p>
  
  <pre><code>var type:Number = Math.random() * 1000;
  var lifeCoinLevel:Number = 1;
  var lives:Number = 2;
  var maxLives:Number = 3;
  var coins:Array = new Array();
  
  if(lifeCoinLevel &gt; 0 &amp;&amp; lives &lt; maxLives &amp;&amp; (type &gt;= 255 &amp;&amp; type &lt;= 345)) {
      coins[1] = new LifeCoin();
  }
  
  coins[1].x = Math.random() * 350 + 145;
  </code></pre>
  
  <p>I got this error when run the game:</p>
  
  <blockquote>
    <p>TypeError: Error #1010: A term is undefined and has no
    properties.<br>   at
    MoneyCatcher_fla::MainTimeline/CreateNewCoin()<br>    at
    Function/http ://adobe.com/AS3/2006/builtin::apply()<br>      at
    SetIntervalTimer/onTimer()<br>    at
    flash.utils::Timer/_timerDispatch()<br>   at flash.utils::Timer/tick()</p>
  </blockquote>
  
  <p>It seems like the if condition not met, but I don't know why. Any thoughts?</p>