效果图:
文本教程:(教程来自--自由风老师实用教程)
1、新建as2.0文档。
2、导入若干张(比方15张)图片到库,分别转化为mc(注册点正中,宽高适宜,加上相框),标识符分别为tu1、tu2、tu3、……、tu15。
3、回到库,图层1(背景),略。
图层2(as),第1帧输入语句:
i = 0;
n = 15; //图片张数
t = 35; //间隔长短
for (j=1; j<=n; j++) {
attachMovie("tu"+j, "tu"+j, n-j+1);
this["tu"+j].xx = this["tu"+j]._x=random(Stage.width-200)+100;
this["tu"+j].yy = this["tu"+j]._y=Stage.height+160;
this["tu"+j].rot = this["tu"+j]._rotation=random(360);
this["tu"+j].onPress = function() {
_root.onEnterFrame = null;
mx.behaviors.DepthControl.bringToFront(this);
this.onEnterFrame = function() {
this._x += (Stage.width/2-this._x)/5;
this._y += (Stage.height/2-this._y)/5;
this._xscale = this._yscale += (180-this._xscale)/5;
this._rotation += (0-this._rotation)/5;
};
};
this["tu"+j].onRelease = this["tu"+j].onReleaseOutside=function () {
bb();
this.x = random(Stage.width-200)+100;
this.y = random(Stage.height-200)+100;
this.rot = random(100)-50;
this.onEnterFrame = function() {
this._x += (this.x-this._x)/5;
this._y += (this.y-this._y)/5;
this._xscale = this._yscale += (100-this._xscale)/5;
this._rotation += (this.rot-this._rotation)/5;
if (Math.abs(100-this._xscale)<=0.5) {
this.onEnterFrame = null;
}
};
};
}
function aa(tu, a) {
if (i>a && i<=a+t) {
if (i == a+1) {
tu._x = tu.xx;
tu._y = tu.yy;
tu._rotation = random(360);
} else if (i == a+2) {
mx.behaviors.DepthControl.bringToFront(tu);
tu.x = random(Stage.width-200)+100;
tu.y = random(Stage.height-200)+100;
tu.rot = random(100)-50;
}
tu._x += (tu.x-tu._x)/5;
tu._y += (tu.y-tu._y)/5;
tu._rotation += (tu.rot-tu._rotation)/5;
}
}
function bb() {
this.onEnterFrame = function() {
i<t*n ? i++ : i=1;
for (j=1; j<=n; j++) {
aa(this["tu"+j], (j-1)*t);
}
};
}
bb();
测试,OK!
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。