Error #1010: A term is undefined and has no properties. when it is not even on the stage
this error cant explain myself why trigger, because doesnt trigger every time - when shoot 1st or last ship of array , somehow changes , doesnt splice or that.
so have doships function:
function doships() { (var i:int = shiparray.length - 1; >= 0; i--) { shiparray[i].movedown() //what code in ship , ship2 class -> only: this.y += 3 (var bcount= _bulletsarray.length-1; bcount >= 0; bcount--) { //if bullet touching ship if (shiparray[i].hittestobject(_bulletsarray[bcount])) { //if here means there`s collision removechild(_bulletsarray[bcount]); _bulletsarray.splice(bcount,1); removechild(shiparray[i]); shiparray.splice(i,1); } } } }
when debug fla error comes from
@ arrayofships_newg_withturret_fla::maintimeline/doships()[arrayofships_newg_withturret_fla.maintimeline::frame1:100]
line 100
if (shiparray[i].hittestobject(_bulletsarray[bcount])) {
before there player on stage shoots bullets
//handling bullets function dobullets(){ //make loop iterate all _bulletsarray on screen (var bcount:int = _bulletsarray.length-1; bcount>=0; bcount--) { //make bullets move _bulletsarray[bcount].y -=20; //if bullet beyond screen remove stage , array if(_bulletsarray[bcount].y < 0) { removechild(_bulletsarray[bcount]) _bulletsarray.splice(bcount,1); } } }
function move player in x coordinate.
and function positions ships,but not important because dont think have error.
i can show code of fla if going somehow solve this.
you splicing _bulletsarray, still looping through it. maybe use while?
More discussions in ActionScript 3
adobe
Comments
Post a Comment