发新话题
打印

练习框框效果

请指点谢谢!
附件: 您所在的用户组无法下载或查看附件

TOP

你如果是鼠标头吻合着框框边角,效果更为逼真细腻。

TOP

我也做了个小例子,大家参考 ---->
附件: 您所在的用户组无法下载或查看附件

TOP

引用:
QUOTE(RGB @ 2005/04/21, 09:29 AM)
你如果是鼠标头吻合着框框边角,效果更为逼真细腻。 [right] 1053682981[/snapback][/right]
这个是昨晚做的太晚了,又怕老爸来说我,急匆匆做好就放上来了 毛衣的我也看一下 呵呵,毛衣的有意思,代码应该复杂很多吧 我哪个只是作了个动画 毛衣我大致写了一下我对你这个动画的制作思路不知道对不对,as代码还没怎么学,只能写一下大致过程 1建立一个框框的mc, 可见度为0 2、onMouseDown mc顶部的坐标=鼠标的坐标 alpha=50% 3、onmousemove mc de movie_xscale y scale , 4 onmouseup 确定形状

TOP

没错,就三个event,不算复杂 smile_big.gif

TOP

我的也完成了,不过发现很多问题 比如下面的code中,我总是一开始在onMouseDown的时候就开启this.moveTo(x1,y1) 这样定位是错误的 因为后面将this.clear()清除前面的,造成x1,y1的定位丢失,所以后面onMouseOver的时候必须加上moveTo 然后对isdrawing=true这个判断是非常必需的,如果不加上后果很严重,直接造成onMouseUp的行为无效,看来这方面做得不好 希望毛衣能解释一下这个原因,我现在还不是很清楚
CODE
this.onMouseDown = function() { this.clear(); x1 = this._xmouse; y1 = this._ymouse; //this.moveTo(x1, y1); 这里开启就有错误了 -_! isdrawing = true; }; this.onMouseMove = function() { if (isdrawing==true) {  this.clear();  this.lineStyle(1, 0xff0000, 50);  x2 = this._xmouse;  y2 = this._ymouse;  this.moveTo(x1,y1);  this.lineTo(x2, y1);  this.lineTo(x2, y2);  this.lineTo(x1, y2);  this.lineTo(x1, y1); }; }; this.onMouseUp = function() { isdrawing = false; this.clear(); this.lineStyle(1, 0xff0000,100); x3 = this._xmouse; y3 = this._ymouse; this.moveTo(x1,y1); this.lineTo(x3, y1); this.lineTo(x3, y3); this.lineTo(x1, y3); this.lineTo(x1, y1); };
附件: 您所在的用户组无法下载或查看附件

TOP

这是我那个文件里的代码,并不复杂。 这两天忙,有时间再来解释这个 smile_big.gif
CODE
this.drawRectangle = function(p1, p2) { this.moveTo(p1.x, p1.y); this.lineTo(p2.x, p1.y); this.lineTo(p2.x, p2.y); this.lineTo(p1.x, p2.y); this.lineTo(p1.x, p1.y); }; this.onMouseDown = function() { this.p1 = {x:_xmouse, y:_ymouse}; this.dragging = true; }; this.onMouseMove = function() { if (dragging) { this.clear(); this.p2 = {x:_xmouse, y:_ymouse}; this.lineStyle(1, 0x000000, 50); this.drawRectangle(p1, p2); } }; this.onMouseUp = function() { this.dragging = false; this.clear(); this.p2 = {x:_xmouse, y:_ymouse}; this.lineStyle(1, 0x000000, 100); this.drawRectangle(p1, p2); };

TOP

对比了一下,我的代码长一些,呵呵 晕 我刚才发现我传上去的代码不起作用了,晕倒 检查了一遍,代码正确,传上去的swf可能传错了现在对了 呵呵

TOP

毛衣的互动性强……

TOP

hahahahahahahahaha

TOP

发新话题