最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 网络设计学院 > Flash教程

Flash画线实现蜘蛛丝的动态更新

日期:08-01    来源:中国设计秀    作者:cnwebshow.com

以前个人网上的一个点辍,用画线实现的,希望给有想象力的同志一点启发,抛砖先效果如下:8os中国设计秀

8os中国设计秀

下面讲下实现的方法,8os中国设计秀
  (1)先建三个MC,如下:8os中国设计秀
 8os中国设计秀

8os中国设计秀

  一个是spider_mc,画一个蜘蛛,像样点就算了,呵呵!一个是net_mc一个网,当背景用的,没有用!最后一个是空的MC,叫line_mc,用来画线的.8os中国设计秀
  (2)回到场景,建三个层如下:8os中国设计秀
 8os中国设计秀

8os中国设计秀

  最底一个叫NET,用来放背景net 的,把net拉进去;中间一个层叫line,用来放line_mc的,把line_mc拉进来,并给这个剪辑命名line_mc;最后一个当然是放spider_mc 的啦,有点废话了!8os中国设计秀
  (3)好,最后关键一步,多建一个action层,写上如下代码:8os中国设计秀
 8os中国设计秀

speed=10; 8os中国设计秀
spider_mc.onEnterFrame = function() { 8os中国设计秀
 dx = _root._xmouse-this._x; 8os中国设计秀
 dy = _root._ymouse-this._y; 8os中国设计秀
 p =Math.atan(dy/dx)*180/Math.PI; 8os中国设计秀
 rota = (dx>0) ? (90+p):(270+p); 8os中国设计秀
 this._x += dx/speed; 8os中国设计秀
 this._rotation = rota; 8os中国设计秀
 this._y += dy/speed;}; 8os中国设计秀
line_mc.onEnterFrame = function() { 8os中国设计秀
 this.clear(); 8os中国设计秀
 this.moveTo(0, 0); 8os中国设计秀
 this.lineStyle(1, 0xffffff, 100); 8os中国设计秀
 this.lineTo(_root.spider_mc._x, _root.spider_mc._y); 8os中国设计秀
};8os中国设计秀

  结束8os中国设计秀