Can someone help me with rain move effect image AS3?
Hi! I will help you to make an animated rain drop as your background in ActionScript 3:
Â
1. First, create a new file then set the size to what you want.
Â
2. You can add another image to set it as the background picture.
Â
3. Add new layer then name it "raincode". Make sure to lock this layer to avoid any replacement of unwanted images.
Â
4. Create your own rain drop image using the graphics and color make it white. Use a linear gradient to look better. Convert your graphic to a movieclip then name it as "raindrop" don't forget to check the checkbox of "Export for ActionScript"
Â
5. Now type the code given below in other ActionScript:
Â
package Classes
{
import flash.display.MovieClip;
import flash.events.Event;
Â
The word "Classes" here is the name of your folder where the class can be found.
6. To be able to use the addChild () method, you need to extend the class
Â
public class Rain extend MovieClip
{
Â
7. You need to use the Flash Player 10 Class "Vector" then put the vector that will work like an array.
Â
private var offset:int = 50; Â
private var dropsNumber:int; Â
private var dropsVector:Vector.<MovieClip> = new Vector.<MovieClip>();
Â
8. Type the main function:
Â
public function init(drops:int, fallSpeed:int, windSpeed:int, hArea:int, vArea:int, dir:String):void Â
{ Â
 dropsNumber = drops;Â
Â
9. You need to make the direction of the rain where its drop:
Â
if (dir == "right") Â
{ Â
offset *= -1; Â
}
Â
10. Add this code in creating the new drop object using the "For statement"
Â
for (var i:int = 0; i < drops; i++) Â
{ Â Â
var drop:Drop = new Drop(); Â
 Â
drop.fallSpeed=fallSpeed;Â
drop.windSpeed=windSpeed; Â
drop.dir=dir; Â
drop.hArea=hArea; Â
drop.vArea=vArea;
Â
11. You need to make a random position:
Â
drop.x = Math.random() * (hArea + offset); Â
drop.y=Math.random()*vArea;
Â
12. And add this code to the scale:
Â
drop.scaleX = Math.round(((Math.random() * 0.8) + 0.3) * 10) / 10; Â
drop.scaleY=drop.scaleX;
Â
13. You need to add a drop using this code:
Â
dropsVector.push(drop); Â
addChild(drop); Â
 Â
} //End of For statement in number 20
 Â
inTheDirection(); Â Â
 Â
} //End of init function
Â
Â
14. Add this code for the direction of the drop vector (open the attachment name 14.txt)
15. This code is for the rain drop moves (open the attachment name 15.text)
16. In the flash IDE type this code
Â
import Classes.Rain; Â
 Â
var rain:Rain = new Rain(); Â
 Â
rain.init(200, 50, 5, 600, 300, "left"); Â
 Â
addChild(rain);
Â