as复制效果《三》飘雪
package {
//********************************************************//
//*******本类由浪子啸天创意设计****************************//
//*******有什么问题请mail:webmaster@flasc.cn******************//
//*******更多的请访问:http://www.flasc.cn***//
//*******转载请注明处处,请保留版权*************************//
//*******************************************************//
import flash.display.*;
import flash.events.*;
public class Snow extends MovieClip {
var speedx=0;
var speedy=0;
public function Snow() {
speedx=.8 * Math.random() - 0.4;
speedy=5 * Math.random();
this.addEventListener(Event.ENTER_FRAME,Mot);
}
function Mot(e:Event) {
this.x+= speedx;
this.y+= speedy;
if (this.y >400) {
init();
}
}
function init() {
this.y=0;
this.x=Math.random() * 550;
}
}
}
flash9中代码:
function DisplaySnows() {
for (var i:int = 0; i < 200; i++) {
var newSnow:Snow = new Snow();
this.addChild(newSnow);
newSnow.x = Math.random()*500;
newSnow.y =-Math.random()*300;
newSnow.alpha = .3+Math.random()*.7;
var scale:Number = .3+Math.random();
newSnow.scaleX = newSnow.scaleY = scale;
}
}
DisplaySnows();
补充:flash教程,As3.0