flash 鼠标拖拉元件的代码

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:40:23
有很多的元件,希望鼠标能任意拖动那些元件进入一个固定的区域,每拖动进固定区域那个元件之后,可以发生新的事件(动画或者出现字之类的)。

box_mc.onPress = function() {
// 鼠标按住的时候,开始拖动名为box_mc的影片剪辑
this.startDrag(false);
}

box_mc.onRelease = function() {
// 鼠标放开的时候,停止拖动影片剪辑
this.stopDrag();
// 判断鼠标位置
if (_xmouse < 200) {
// 当鼠标位置的x坐标小于200的时候做什么
trace("舞台左边")
}
}