Teach you how to use flash to make mosaic effect

Source: Internet
Author: User
Tags array file size

Technical Highlights: Duplicatemovieclip (Copy command), array application, color settings.

Production steps:

1. Open Flash MX, create a new Flash movie file, file size default.

2. Press F8 to create a new symbol for the movie clip attribute, named FG. Select the rectangular drawing tool to draw a small square with a size of 1010, with any line and fill color, and an X position of 0,y position 0. Press Ctrl+l to open the Repository window to see the FG symbol in the repository.

3. Click Sence1 to enter the main scene, and then press F8 to create a new symbol for another movie clip attribute, named Mosaic. Enter the mosaic editing interface, drag the FG symbol from the repository into the scene, enter its instance name as F0 in the property bar instance Name box, and set the X position to the 0,y position of 0.

4. Click the New Layer button, create a new layer, named Actions, select the first frame of the layer, press F9 to open the action panel, in the Action panel, enter the following actions:

row=15; Number of rows

col=15; Number of columns

for (i=1;i<=row;i++) {//copy Row*col Squares

for (j=1;j=col;j++) {

S=f0.duplicatemovieclip ("F" +i+j,col*i+j);

Trace (S._name);

s._x=f0._width* (j-1);

s._y=f0._height* (i-1);

S.onenterframe=function () {

This._alpha=random (60) +40;//Set transparency

col=[0x66cc00,0x99cc00,0xffcc33];//defines an array of colors

C=new Color (this);

C.setrgb (Col[random (3)]);//Set color

}

}

}

f0._visible=0;//Settings F0 not visible

5. Click Sence1 again, return to the main scene, at this time there is no content in the main scene, double-click the first layer of text to rename the layer to pic, press CTRL+R, import a picture. Then create a new layer named Mosaic, select the first blank frame of the layer, drag the mosaic symbol from the database into the main scene, and drag to adjust its position to where you want the mosaic effect to apply. Ctrl+enter test can be.

Note: In this I will make a mosaic effect of a movie clip symbol, it can be invoked only by dragging it from the database into the scene, and by changing the number of rows in the actions to change the size of the mosaic overlay, you can also redefine the colors in the color array  the hexadecimal number , Very convenient to use.



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.