发新话题
打印

peif2003 请进

peif2003 请进

上次那个话题,我做了2个挂钩,有些问题,就是快速拖动时候,跟随效果就不好。能看看问题是在哪里么?
还有就是教教我,就这个如何用类去完成呢?
附件: 您所在的用户组无法下载或查看附件

TOP

peif2003 请进

看看这样的效果可以接受吗?我觉得你还是先打牢基础再去研究类的写法。
var kk:Boolean;
gg1.onPress = function() {
this.startDrag();
};
gg2.onPress = function() {
kk = false;
this.startDrag();
};
gg1.onRelease = function() {
this.stopDrag();
};
gg2.onRelease = function() {
this.stopDrag();
if (this.hitTest(gg1)) {
kk = true;
togetherMove();
} else {
kk = false;
}
};
onEnterFrame = function () {
if (kk) {
togetherMove();
}
};
function togetherMove() {
_root.gg2._x = _root.gg1._x;
_root.gg2._y = _root.gg1._y+80;
}

TOP

peif2003 请进

var kk:Boolean;
//onEnterFrame = function () {
function guagou() {
if (kk && !gg2.ok) {
_root.gg2._x = _root.gg1._x;
_root.gg2._y = _root.gg1._y+80;
}
if (gg2.up.hitTest(gg1.down)) {
kk = true;
} else {
kk = false;
}
updateAfterEvent();
}
setInterval(guagou, 20);

TOP

peif2003 请进

同意'; 一点点  ';的观点
你还是先打好基础吧~

TOP

peif2003 请进

谢谢两位。
不过我还是想学阿,给点提示吧。。。

TOP

peif2003 请进

像,自己做滚动条一样,当鼠标快速移动离开按钮,会失效的.....

TOP

peif2003 请进

好好体会 peif2003 写的代码,他和我写只是前后次序不一样,但是效果却有很大不同。这就是我和高手们的差距了。我会努力去学的。。。

TOP

发新话题