You should have class definition for Block
. It could be exported as part of .swc library or defined in code. Without definition of Block
class of cause you will have errors.
Also you could improve your main loop, you shouldn't perform several times same lookup with getChildAt
and operations is
and as
also could be optimised:
function mainLoop(e:Event) {
var block:Block, len:int = numChildren, i:int;
for (i = 0; i < len; i++) {
block = getChildAt(i) as Block;
if (block != null) {
if (block.hitTestPoint(mouseX, mouseY)) {
trace("hit");
}
}
}
}