if(contains) & removeChild problems
so i want to make it whenever evilShadow touches charShadow, dark is added. the whole function is an enter frame function. and whenever evilshadow does not touch charShadow there shouldnt be any dark.
if(evilShadow.hitTestObject(charShadow))
{
if(fadePresent == false)
{
dark = new DarkFade;
dark.scaleX = 4;
dark.scaleY = 4;
addChild(dark);
fadePresent = true;
}
}
if((evilShadow.hitTestObject(charShadow)==false)&&(contains(dark)))
{
fadePresent = false;
removeChild(dark);
}
everythin works fine but this error shows up
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/contains()
at HorrorGame/checkforHits()
