Demo Effect:
Click here to download the source file
1, the production method is very simple, first import a picture of the appropriate size, and then select the picture press F8 to convert it to a movie clip symbol. As shown in figure:
2, then we click to select the picture on the stage, and then press F9 to open the Action panel, add the following code:
onclipevent (load) {///When a movie clip appears on the timeline, executes the statement in the curly brace
Numx =;
Numy = 70;//Defines the dimensions of the image display
Numperframe = 60;//define pin speed
Currsquare = 0;
choices = new Array ();
for (i=0; i<numx*numy; i++) {
Choices.push (i);//define a new array and keep increasing the array length
}
_root.createemptymovieclip (" Mask ", 0);///
This.setmask (_root.mask);//Create a movie clip as a mask
function drawsquare (x, y) {
with (_root.mask) {
MoveTo (x, y);
Beginfill (0x000088);
LineTo (x+10, y);
LineTo (x+10, y+10);
LineTo (x, y+10);
Endfill ()//Draw this mask, the shape is 10*10 pixels
}
}
}
Onclipevent (enterframe) {//Movie clip needle frequency constantly triggers this action
if ( Currsquare<numx*numy) {
for (i=0; i<numperframe; i++) {
J = random (choices.length);
t = choices[j];
Choices[j] = choices[choices.length-1]; Randomly select the time at which the party will appear
Choices.pop ();//start deleting the elements in the array choices
x = t%numx;
y = Math.floor (T/NUMX);//returns the lower value of the expression in the argument
Drawsquare (x*10, y*10);
Currsquare + = Numperframe;
This._alpha = currsquare/(numx*numy) *100;//setting Transparency
}
}
Finally, you can press the Ctrl+enter button to test the film!