Flash in the lifelike waterfall effect animation source code

Source: Internet
Author: User

Send a small tutorial to a triple friend who likes the waterfall effect.

AS3 Waterfall class: You can change your waterfall properties by manipulating simple parameters, or you can make your waterfall background transparent and placed on a background image of your choice. The waterfall class extends from the Sprite class. Therefore, Waterfall is an interactive display object that can be added to the stage. To create a waterfall, simply call the constructor with "new" as the keyword.

Example:

1, the download of the name of the COM source files extracted to a directory.

2, open Flash, create a FLA document, stored in the same directory of COM's class library.

3, select Layer 1 frame 1th, press F9 to open the Action panel, enter the code:

Import Class Library

Import com.flashandmath.dg.display.*;

Creates an instance and initializes the

var waterfall:waterfall = new Waterfall (200,300,false);

Coordinate positioning

waterfall.x = 100;

WATERFALL.Y = 30;

Add to display list

Stage.addchild (waterfall);

Waterfall.startflow ();

The above code creates a width of 200 heights of 300 waterfalls (these are only the dimensions of the display area, not the size of the water itself). If the third argument is set to "true", the waterfall will have a background transparency, allowing you to replace the background behind the waterfall, and if the transparency parameter is set to "false", the waterfall will have a black background.

If you want to modify the width and height of the waterfall, open the waterfall.as file under Comflashandmathdgdisplay to modify it.

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.