Note that there are some explanatory texts on larger screens.

plurals
  1. POTypeError: Error #2007: Parameter hitTestObject must be non-null. Why
    primarykey
    data
    text
    <p>So im trying to make a bullet-ship hitTestObject ,but i don`t know why the variable representing the bullets.length doest change.</p> <p>so the error comes from this function </p> <pre><code>function doShips() { trace("bcount :" + bcount) trace("_bulletsArray length:" + _bulletsArray.length) for (var i:int = shipArray.length - 1; i &gt;= 0; i--) { shipArray[i].moveDown() //what the code in the Ship and Ship2 class does -&gt; only: this.y += 3 for (var bcount= _bulletsArray.length-1; bcount &gt;= 0; bcount--) { //if the bullet is touching the ship while (shipArray[i].hitTestObject(_bulletsArray[bcount])) { //if we get here it means there`s is a collision removeChild(_bulletsArray[bcount]); _bulletsArray.splice(bcount,1); removeChild(shipArray[i]); shipArray.splice(i,1); } } } </code></pre> <p>}</p> <p>before that i have also a shoot function that shoots bullets and puts them in the _bulletsArray.</p> <p>when the traces come it is showing : when i dont shoot bullets it gives me this</p> <pre><code>_bulletsArray length: 0 bcount: 0 </code></pre> <p>and when i shoot it gives me this :</p> <pre><code>bcount: 0 _bulletsArray length: 1 </code></pre> <p>or </p> <pre><code> bcount: 0 _bulletsArray length: 2 </code></pre> <p>so why doesnt the bcount change when The the _bulletsArray changes , when i am telling it to do so in the <code>for (var bcount= _bulletsArray.length-1; bcount &gt;= 0; bcount--) {</code> even worse - when i datatype the 'bcount to a number 'bcount:Number' it gives me NaN</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload