论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Flash教程
Tag:flash cs,flash 8,鼠绘,as,手绘,工具,文字,loading,入门,初学,mc,影片剪辑,声音,mtv,游戏,引导,遮罩,菜单,补间,广告条,时钟,视频教程

Flash教程:飞舞的两只蝴蝶2

文章类别:Flash | 发表日期:12-10-16

Flash教程:飞舞的两只蝴蝶2


9.新建一个图层改名为action,然后按F9打开动作面板,输入如下动作:
probability = 100;
scene_width = 500;
scene_height = 290;
speed = 0.03;
depth = 15;
MovieClip.prototype.smoothMove = function (speed, targetx, targety) {
 this._x += speed*(targetx-this._x);
 this._y += speed*(targety-this._y);
};
MovieClip.prototype.rotateTo = function (targetx, targety) {
 var diffX = targetx-this._x;
 var diffY = targety-this._y;
 this._rotation = Math.atan2 (diffY, diffX)*180/Math.PI;
};
_root.transp0.onEnterFrame = function () {
 if (random (probability) == 1) {
  target0X = random (scene_width);
  target0Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target0X, target0Y);
};
_root.transp1.onEnterFrame = function () {
 if (random (probability) == 1) {
  target1X = random (scene_width);
  target1Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target1X, target1Y);
};
_root.fly0_mc.onEnterFrame = function () {
 this.smoothMove (speed, transp0._x, _root.transp0._y);
 this.rotateTo (_root.transp0._x, _root.transp0._y);
};
_root.fly1_mc.onEnterFrame = function () {
 this.smoothMove (speed, transp1._x, _root.transp1._y);
 this.rotateTo (_root.transp1._x, _root.transp1._y);
};
_root.shadow0_mc.onEnterFrame = function () {
 this.smoothMove (speed, transp0._x, _root.transp0._y+depth);
 this.rotateTo (_root.transp0._x, _root.transp0._y+depth);
};
_root.shadow1_mc.onEnterFrame = function () {
 this.smoothMove (speed, transp1._x, _root.transp1._y+depth);
 this.rotateTo (_root.transp1._x, _root.transp1._y+depth);
};
   动画制作完成,按Ctrl+回车键可以测试动画了!Thank you!有兴趣的同学赶紧试一试吧!

视频教程列表
文章教程搜索
 
Flash推荐教程
Flash热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058