flash8新体验:小试Point类
类别: Flash教程
用鼠标在小球的其它地方点击:
« Full Screen »
代码:
代码:
import flash.geom.Point;
this.onMouseDown = function() {
var p1:Point = new Point(mc._x, mc._y);
var p2:Point = new Point(_xmouse, _ymouse);
var d:Point = p2.subtract(p1);
d.normalize(10);
mc.onEnterFrame = function() {
var v = p1.add(d);
p1.x = mc._x=v.x;
p1.y = mc._y=v.y;
if (d.x>0 && p1.x>=p2.x || d.x<0 && p1.x<=p2.x) {
delete mc.onEnterFrame;
}
};
};
- 上一篇: Flash实例视频教程:动态手机屏幕背景图制作(2)
- 下一篇: Flash制作带缓冲的滚动条
-= 资 源 教 程 =-
文 章 搜 索