flash9复制效果《二》水泡

作者:袖梨 2022-07-02

H2O类:

//********************************************************//
//*******本类由浪子啸天创意设计****************************//
//*******有什么问题请mail:[email protected]******************//
//*******更多的请访问:http://www.flasc.cn***//
//*******转载请注明处处,请保留版权*************************//
//*******************************************************//

package {
 import flash.display.*;
 import flash.events.*;

 public class H2O extends MovieClip {
  var speedx = 0;
  var speedy = 0;
  public function H2O() {
   speedx = .5*Math.random()-0.5;
   speedy = 5*Math.random();
   this.addEventListener(Event.ENTER_FRAME, Mot);
  }
  function Mot(e:Event) {
   this.x +=speedx;
   this.y -=speedy;
   if (this.y<0) {
    init();
   }
  }
  function init() {
   this.y=400;
   this.x=Math.random()*550;
  }
 }
}

 

flash9内代码:

function DisplayCircles()
{
for (var i:int = 0; i <100; i++)
{
var h2o:H2O = new H2O();
this.addChild(h2o);
h2o.x = Math.random()*500;
h2o.y =Math.random()*300+400;
h2o.alpha = .2+Math.random()*.5;
 
var scale:Number = .3+Math.random();
h2o.scaleX = h2o.scaleY = scale;
}
}
DisplayCircles();

相关文章

精彩推荐