Error #2007 how to fix it?

I am getting an error with my hitTestObject for the boss1 and I don't know how to fix it. The part that becomes the problem is blue and everthing else is fine. I tried to go on the thing degbug, and that did not help...

package
{

import flash.display.MovieClip;
import flash.events. *;
import flash.text.TextField;
flash.ui import. *;
import flash.display. *;

SerializableAttribute public class extends MovieClip Arrow
{
var speed: Number = 25;
var: a game;
var boss1:Boss1;

public void Initialize (e: event)
{
This.rotation = Man.rot + 180;
game = stage.getChildByName("root1") as game;
boss1 = stage.getChildByName ("root2") as Boss1;
}


public void Arrow()
{
this.addEventListener (Event.ENTER_FRAME, this.) OnEnterFrame);
this.addEventListener (Event.ADDED_TO_STAGE, this.) (Commissioning);
}
public void OnEnterFrame(e:Event)
{
x = x + Math.cos (rotation/180*Math.PI+80.1) * speed;
y = y + Math.sin (rotation/180*Math.PI+80.1) * speed;
If (this.y <-250) RemoveArrow();
for (var i in game.enemyList)
{
If (this.hitTestObject (Game.enemyList [i]))
{
game.enemyList [i]. Damage (Bow.Damage);
If (game.enemyList [i]. GetHealth() < = 0)
{
Man.Money += Math.ceil (Math.random () * 4) + 1;
game.enemyList [i]. RemoveWolf1();
game.enemyList.splice (i, 1);
if(Man.Age == 1)
{
Man.kills1 += 1;
}
if(Man.Age == 2)
{
Man.kills2 += 1;
}
if(Man.Age == 3)
{
Man.kills3 += 1;
}
if(Man.Age == 4)
{
Man.kills4 += 1;
}
if(Man.Age == 5)
{
Man.kills5 += 1;
}
if(Man.Age == 6)
{
Man.kills6 += 1;
}
if(Man.Age == 7)
{
Man.kills7 += 1;
}
}

RemoveArrow();
break;
}
}
(var t in game.ccheifList)
{
If (this.hitTestObject (Game.ccheifList [t]))
{
game.ccheifList [t]. Damage (Bow.Damage);
If (game.ccheifList [t]. GetHealth() < = 0)
{
Man.Money += Math.ceil (Math.random () * 30) + 5;
game.ccheifList [t]. RemoveCaveCheif();
game.ccheifList.splice (t, 1);
if(Man.Age == 1)
{
Man.kills1 += 1;
}
if(Man.Age == 2)
{
Man.kills2 += 1;
}
if(Man.Age == 3)
{
Man.kills3 += 1;
}
if(Man.Age == 4)
{
Man.kills4 += 1;
}
if(Man.Age == 5)
{
Man.kills5 += 1;
}
if(Man.Age == 6)
{
Man.kills6 += 1;
}
if(Man.Age == 7)
{
Man.kills7 += 1;
}
}
RemoveArrow();
break;
}

}
If (this.hitTestObject (boss1))
{
Boss1.health = Bow.Damage;
If (Boss1.health < = 0)
{
Man.Money += Math.ceil (Math.random () * 100) + 100;
Boss1.Remove = true;
}
RemoveArrow();
}
for (var r in game.caveList)
{
If (this.hitTestObject (Game.caveList [r]))
{
game.caveList [r]. Damage (Bow.Damage);
If (game.caveList [r]. GetHealth() < = 0)
{
Man.Money += Math.ceil (Math.random () * 10) + 5;
game.caveList [r]. RemoveCaveMan();
game.caveList.splice (r, 1);
if(Man.Age == 1)
{
Man.kills1 += 1;
}
if(Man.Age == 2)
{
Man.kills2 += 1;
}
if(Man.Age == 3)
{
Man.kills3 += 1;
}
if(Man.Age == 4)
{
Man.kills4 += 1;
}
if(Man.Age == 5)
{
Man.kills5 += 1;
}
if(Man.Age == 6)
{
Man.kills6 += 1;
}
if(Man.Age == 7)
{
Man.kills7 += 1;
}
}

RemoveArrow();
break;
}

}


}
public void RemoveArrow()
{
this.removeEventListener (Event.ENTER_FRAME, this.) OnEnterFrame);
this.removeEventListener (Event.ADDED_TO_STAGE, this.) (Commissioning);
this.parent.removeChild (this);
}


}

}

You have a periodic function, the OnEnterFrame function, which is called over and over again. In this function, you have a hitTest for an object whose value is stored in a variable, boss1. When you remove Boss1, the value is stored in the variable boss1, the variable has no value or reference, and so the hitTestFunction generates an error. He has nothing to work with.

So, if you take the value stored in boss1, you need to either stop the execution of the OnEnterFrame function or you will have to work around the section of the function that performs the hit test.

Which helps explain the problem?

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • FF no longer updates of passwords, record the passwords is selected.

    Firefox 26.0 suddenly stopped updating my passwords. It asks if I want that he remember new passwords, but I changed my yahoo mail password and it does not ask if I want to update the password. When I come back it still has the old password.

  • Increase the video memory of the A40-211

    Hi all I have the Satellite A40-211. The Intel chipset also supports all of the graphical stuff, so he needs a little more memory RAM as video memory. This is possible up to a maximum of 64 MB. The problem is that the chipset is now using a maximum o

  • OfficeJet 6500 a print is more black

    It seems that I too was victim of the issue of "change the cartridge and cannot print.I changed the black cartridge, cleaned the heads several times and nothing.Print many pages of test - color... Black work does not work.I confirmed that the cartrid

  • HP photosmart C4780: HP C4780 wireless connection

    Have router Verizon Wireless and security settings changed from WEP to WPA2 - my SSID is the same, but must enter new password - is the only way to do it on the printer is plug it via USB? Can I change wireless? I printed the network configuration, b

  • update screen never answers, anyone know why?

    whenever I try to update my laptop, the updates install screen does not respond and I have to open a task manager to close the screen. It happens only on this specific screen, can anyone help?