Createjs 碰撞问题 localToLocal not a function error

Createjs collision issue localToLocal not a function error

我正在尝试检查 My (Loc) 和 CandyLocation 之间的冲突。我收到此错误 Uncaught TypeError: loc.localToLocal is not a function.

知道我做错了什么或者我该如何解决吗?

  var loc;
        function checkIfeatingFood() {
            loc = locations[locations.length - 1];
            // for (var j = 0; j < candyLocations.length; j++) {
            for (var j = 0; j < answersContainer.children.length; j++) {

                var candyLocation = answersContainer.children[j];
                candyLocation.alpha = .2;
                var pt = loc.localToLocal(100, 0, candyLocation);
                console.log(candyLocation.x, candyLocation.y); // the position local to objB


                if (candyLocation.hitTest(pt.x, pt.y)) { candyLocation.alpha = 1; }


            }

            //return false;
        }

您确定 loc 是 DisplayObject 吗?