Flash 9 replication effect II blister

Source: Internet
Author: User

H2O class:

//************************************** ******************//
************************ ****//
// *** If you have any questions, mail: webmaster@flasc.cn ******************//
// *** For more information, visit: http://www.flasc.cn ***//
// ******* For reprinting, please indicate everywhere, please retain the copyright *************************//
//************************************** *****************//

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

 

Code in Flash 9:

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 ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.