//AS2.0
var mc = this.createEmptyMovieClip("mc", 0); //建立一個空白mc在層級0
for (var i = 0; i
var mf = mc.attachMovie("mf", "mf"+i, i); //在mc內迴圈建立40個空白mc,名字為mf0 - mf39
mf.vr = 0; //mf例項的自定義屬性vr 以下類同 vy sdy sdx vx等
mf.vy = 0;
mf.sdy = Math.random()/2;
mf.sdx = Math.random();
mf.vx = 0;
random(2) == 0 ? mf.sj=1 : mf.sj=-1; //產生一個隨機值 判斷是否為0,根據情況賦值mf例項的自定義屬性sj為正負1
mf._x = random(550); //隨機設定mf例項的x y 座標
mf._y = random(300);
mf._xscale = mf._yscale=random(70)+20; //隨機縮放比例為%20 - %90
mf.sj
mf.mcl = 0.8;
mf.swapDepths(mf._xscale*1000+i); //設定mf例項的層級分佈在 正負1000+(0至39) 這個範圍的層級內
mf.onEnterFrame = function() {
this.vr += 0.03;
this._y += Math.cos(this.vr)*this.vy*this.sj;
this._x -= this.vx*this.sj;
this.vy *= this.mcl;
this.vx *= this.mcl;
this.vy += this.sdy;
this.vx += this.sdx;
var ID = Math.random()*30 >> 0;
ID == 1 && (this.mcl=0.9);
ID == 2 && (this.mcl=0.7);
ID == 3 && (this.mcl=0.5);
ID == 4 && (this.yj.play());
this._x
this._x>550 && (this._x=0);
};
}
//AS2.0
var mc = this.createEmptyMovieClip("mc", 0); //建立一個空白mc在層級0
for (var i = 0; i
var mf = mc.attachMovie("mf", "mf"+i, i); //在mc內迴圈建立40個空白mc,名字為mf0 - mf39
mf.vr = 0; //mf例項的自定義屬性vr 以下類同 vy sdy sdx vx等
mf.vy = 0;
mf.sdy = Math.random()/2;
mf.sdx = Math.random();
mf.vx = 0;
random(2) == 0 ? mf.sj=1 : mf.sj=-1; //產生一個隨機值 判斷是否為0,根據情況賦值mf例項的自定義屬性sj為正負1
mf._x = random(550); //隨機設定mf例項的x y 座標
mf._y = random(300);
mf._xscale = mf._yscale=random(70)+20; //隨機縮放比例為%20 - %90
mf.sj
mf.mcl = 0.8;
mf.swapDepths(mf._xscale*1000+i); //設定mf例項的層級分佈在 正負1000+(0至39) 這個範圍的層級內
mf.onEnterFrame = function() {
this.vr += 0.03;
this._y += Math.cos(this.vr)*this.vy*this.sj;
this._x -= this.vx*this.sj;
this.vy *= this.mcl;
this.vx *= this.mcl;
this.vy += this.sdy;
this.vx += this.sdx;
var ID = Math.random()*30 >> 0;
ID == 1 && (this.mcl=0.9);
ID == 2 && (this.mcl=0.7);
ID == 3 && (this.mcl=0.5);
ID == 4 && (this.yj.play());
this._x
this._x>550 && (this._x=0);
};
}