hitTestObject on child of a MC

筅森魡賤 提交于 2019-12-08 17:06:27

Try explicitly iterating through the children.

private function cMove(e:MouseEvent):void
    {
        for (var ii : uint = 0; ii < playerP.numChildren; ++ii)
        {
            if (e.currentTarget.hitTestObject(playerP.getChildAt(ii)))
            {
                trace("hit la");
            }
        }
    }
FJW

I am trying to reference a movieclip that has 2 layers and 2 instance references. One is called Erik, the other hit. Currently the larger Erik is working, how can I make 'hit' be the target.

for (var ii : uint = 0; ii < target.numChildren; ++ii) {
    if (e.currentTarget.hitTestObject(target.getChildAt(ii))){
        trace("hit la");
    }
}

This works but on Erik which is set by

public function Catcher(stageRef:Stage, target:Erik) : void

as Erik is a class object.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!