养生 装修 购物 美食 感冒 便秘 营销 加盟 小吃 火锅 管理 创业 搭配 减肥 培训 旅游

Flash中图片不停循环播放,可改变左右方向

时间:2024-09-22 02:03:34

在Flash中制作图片循环播放(非补间动画),可通过按钮改变左右方向

Flash中图片不停循环播放,可改变左右方向

工具/原料

Flash8.0,AS2.0

步骤/方法

1、导入图片(这里以8张图片为例,且例子中图片为临时绘制的矩形水貔藻疽,实际中可导入自己想要的图片),每导入一张都将其转换为影片剪辑(图片上点右键-转换为元件-影片剪辑),共8个影片剪辑。(从图片1至图片8)

Flash中图片不停循环播放,可改变左右方向

Flash中图片不停循环播放,可改变左右方向

2、在图层1,将8个影片剪辑都放入场景,并将它们之间间隔的距离设置成相同,第1张图片与剑钕饿粪场景左边的距离与它们之间间隔的距离也相同。

Flash中图片不停循环播放,可改变左右方向

3、从图片1开始,依次为每个影片剪辑都设置实例名称(属性-实例名称,依次为mcmc...、mc8)......

Flash中图片不停循环播放,可改变左右方向

Flash中图片不停循环播放,可改变左右方向

4、图层2,画一个矩形,长度比场景的宽度短一些,可以将左右两个按钮显现出来。

Flash中图片不停循环播放,可改变左右方向

5、在图层2上设置遮罩

Flash中图片不停循环播放,可改变左右方向

6、新建图层3,添加两个按钮进来,放在场景的左右两边。

Flash中图片不停循环播放,可改变左右方向

7、给两个按钮分别设置实例名称为:anan2

Flash中图片不停循环播放,可改变左右方向

Flash中图片不停循环播放,可改变左右方向

8、再新建图层4,在这一帧设置帧动作:kk=mc8._x+mc8._width;for(i屏顿幂垂=1;i<=8;i++像粜杵泳){_root["mc"+i].onEnterFrame=function(){this._x-=5;if(this._x+this._width<=0){this._x=kk-this._width;}};_root["mc"+i].onRollOver=function(){for(j=1;j<=8;j++){delete_root["mc"+j].onEnterFrame;}};_root["mc"+i].onRollOut=function(){for(i=1;i<=8;i++){_root["mc"+i].onEnterFrame=function(){this._x-=5;if(this._x+this._width<=0){this._x=kk-this._width;}};}};}an1.onRollOver=function(){//向左的按钮动作for(i=1;i<=8;i++){_root["mc"+i].onEnterFrame=function(){this._x-=5;if(this._x+this._width<=0){this._x=kk-this._width;}};_root["mc"+i].onRollOver=function(){for(j=1;j<=8;j++){delete_root["mc"+j].onEnterFrame;}};_root["mc"+i].onRollOut=function(){for(i=1;i<=8;i++){_root["mc"+i].onEnterFrame=function(){this._x-=5;if(this._x+this._width<=0){this._x=kk-this._width;}};}};}};an2.onRollOver=function(){//向右的按钮动作for(i=1;i<=8;i++){_root["mc"+i].onEnterFrame=function(){this._x+=5;if(this._x+this._width>=kk){this._x=0-this._width;}};_root["mc"+i].onRollOver=function(){for(j=1;j<=8;j++){delete_root["mc"+j].onEnterFrame;}};_root["mc"+i].onRollOut=function(){for(i=1;i<=8;i++){_root["mc"+i].onEnterFrame=function(){this._x+=5;if(this._x+this._width>=kk){this._x=0-this._width;}};}};}};

© 一点知识