# Rain with Water Ripple Flash Particle System

Step 2: Scale and Set Alpha of Rain Drop Particles

To create a more realistic flash raining effect, this is better to scale and set alpha to the rain drop particles randomly.

Please update flash player to view this Flash ActionScript tutorial!

## Flash Tutorial Content:

The rain drop particles of the Flash raining effect were all created. However the rain drop particle look very dull, with same size and same transparancy. Let's scale and set alpha to the rain drop particles randomly so that they look more natural.

The first Flash Movie of this tutorial is shown as above.

## Flash ActionScript Codes:

// Declare number of Rain Drops
var numOfRain:uint = 10;

// Creates 10 Rain Drops on the stage.
for (var i:uint = 0; i < numOfRain; i++) {

// Create a new Rain Drop
// Remember to set linkage in Movie Library
var rain:RainDrop = new RainDrop();

// Add the Rain Drop to the stage
addChild(rain);

// Assign start location of Rain Drops
// x-axis: 0 - 490
// y-axis: 0 - 200
rain.x = Math.random() * 490;
rain.y = Math.random() * 200;;

// Assign random alpha to Rain Drop
// Math.random returns value between 0 - 1
// i.e.
// Minimum value = 0.4 + 0 = 0.4
// Maximum value = 0.4 + 0.6 = 1.0
// Summary:
// Assign random alpha between 0.4 and 1.0
rain.alpha = 0.4 + Math.random() * 0.6;

// Assign random scale to Rain Drop
// Math.random returns value between 0 - 1
// i.e.
// Minimum value = 0.3 + 0 = 0.3
// Maximum value = 0.3 + 0.3 = 0.6
// Summary:
// Assign random scale between 0.3 and 0.6
rain.scaleX = 0.3 + Math.random() * 0.3;
rain.scaleY = rain.scaleX;

}

Remarks:

This Flash ActionScript rain with water ripple effect tutorial shows how to scale and set alpha of the rain drops particles randomly.