flash如何设置多个触碰元件

来源:百度知道 编辑:UC知道 时间:2024/07/02 23:51:29
_root.onEnterFrame = function() {
if (_root.mogu.hitTest(tuzi.gongji)) {
_root.mogu.gotoAndPlay(2);
;
}

};
实例tuzi的gongji碰到实例mogu,实例mogu跳到二帧。
这个可以用的,可是为什么只能设定1个 再用这个代码设定mogu2怎么就不起作用呢,还是说,只能弄1个
459551049@qq.com

第二次的触发条件是什么?别又是进入帧的时候,那只能来一次哦,弄个循环mc作为检测条件来启动检测事件

我测试了一下,应该是没问题的,我也说说我的做法
新建以下三个元件:
mc_1
mc_2
target

其中target元件的注册点设置在中心,而不是左上角。
然后在帧上输入以下As.

var targetwith:Boolean=true
target.onPress=function()
{
if(targetwith==true)
{
targetwith=false
this.onEnterFrame=function()
{
this._x=_xmouse;
this._y=_ymouse;
if(this.hitTest(mc_1))
{
trace("mc_1")
}
if(this.hitTest(mc_2))
{
trace("mc_2")
}
}

}else{
targetwith=true;
delete this.onEnterFrame;

}
}

应该就OK了。如果需要的话,可以留下E-mail,我把例子发你