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

时间:2024-10-12 21:14:12

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

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

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

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

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

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

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

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

5、在图层2上设置遮罩

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

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

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

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

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;}};}};}};

© 手抄报圈