Hello,
For all you clever folks out there, I have a problem!
EDIT: I’m using CS4
I’m receiving this error:
TypeError: Error #1010: A term is undefined and has no properties.
at Main_fla::function_holder_mc_16/cleanList()
at enemy1_mc/killWPlode()
at enemy1_mc/update()
You can find my file at: http://www.truploader.com/view/682740
Below is my function to clean my list. That part works - however for some reason I’m getting errors…
ActionScript Code:
function cleanList():void {
var lLength:int=MovieClip(root).enemyList.length;
for (var i:int = 0; i<lLength; i+=1) {
if (! MovieClip(root).enemyList*.alive) {
MovieClip(root).enemyList.splice(i,1);
}
}
}
The cleanList function is called here:
ActionScript Code:
//passedText
addEventListener(“enterFrame”,update);
var ySpeed:Number=3;
var health:Number=1;
var collideDamage:Number=8;
var noPoint:Boolean=false;
var arrayLocation:Number;
var alive:Boolean;
var cashValue:Number=50;
cacheAsBitmap=true;
function update(e:Event):void {
if (! MovieClip(root).isPaused) {
this.y+=ySpeed;
if (y>stage.height) {
this.kill();
}
if (health<1) {
killWPlode();
}
}
}
function kill():void {
removeEventListener(Event.ENTER_FRAME, update);
if (MovieClip(root).contains(this)) {
MovieClip(root).removeChild(this);
}
alive=false;
MovieClip(root).functions.cleanList();
}
function killWPlode():void {
if (animation) {
animation.play();
}
removeEventListener(Event.ENTER_FRAME, update);
if (! noPoint) {
MovieClip(root).functions.writeText(this.x,this.y,cashValue);
}
alive=false;
MovieClip(root).functions.cleanList();
}