I just started making a really simple video game for a class and I have a random score point spawner. This function works fine, nothing goes wrong, but when I publish the game and play it with Flashy Player, it shows up with the error message
Error #2025: The supplied DisplayObject must be a child of the caller.
I've just been dismissing it since the program works other than the alert prompt, but I need to remove that.
function spawnscore()
{
i = 0
while (i == 0)
{
var pointy = Math.random()*640
var pointx = Math.random()*747
var pointcirc:warning = new warning();
addChild(pointcirc);
pointappearmusic.play();
setTimeout(removepoint, 1500);
pointcirc.addEventListener(MouseEvent.MOUSE_OVER, scoreclicked);
function scoreclicked()
{
pointsound10.play();
removeChild(pointcirc);
score += 10;
removeEventListener(MouseEvent.MOUSE_OVER, scoreclicked);
}
function removepoint()
{
// I'm pretty sure this is the problem
removeChild(pointcirc);
}
pointcirc.x = pointx;
pointcirc.y = pointy;
break;
}
return;
}
I'm pretty sure my problem is in the removepoint function, but I can't figure out what to do.
Edit : highlight error