I get this error when I try to create a rectangle for an object in an array.
TypeError: Error #1006: getRect is not a function.
The line that causes the error is the third one.
for (var i:int = 0; i < fixedObjects.length; i++)
{
var wallRect:Rectangle = fixedObjects*.getRect(this);
//trace(wallRect+"wall");
trace(fixedObjects*.getRect(this));
//trace(newCharRect+"char");
if (newCharRect.intersects(wallRect))
{
trace("should work");
// ball hitting left or right side
if (oldCharRect.right < wallRect.left)
{
trace("left");
//newBallX += 2*(brickRect.left - oldBallRect.right);
//ballDX *= -1;
}
else if (oldCharRect.left > wallRect.right)
{
trace("right");
}//newCharX += 2*(brickRect.right - oldBallRect.left);
//ballDX *= -1;
// ball hitting top or bottom
if (oldCharRect.top > wallRect.bottom)
{
trace("bottom");
//ballDY *= -1;
//newBallY += 2*(brickRect.bottom-newBallRect.top);
}
else if (oldCharRect.bottom < wallRect.top)
{
trace("top");
}//ballDY *= -1;
//newBallY += 2*(brickRect.top - newBallRect.bottom);
}
}
I attached the full .as