level 2
给你这个例子
//拖动mca到mcb上,只要碰撞就重叠放置
mcx = mca_mc._x;
mcy = mca_mc._y;
mca_mc.onPress = function(){
this.startDrag(true);
}
mca_mc.onRelease = function(){
stopDrag();
if(this.hitTest(mcb_mc)){
//检测只要两个mc有交集,则返回true
this._x = mcb_mc._x;
this._y = mcb_mc._y;
} else {
this._x = mcx;
this._y = mcy;
}
}
2015年03月06日 07点03分