Flash, Snowflake, float (pure)

Source: Internet
Author: User
Tags comments

Insert into filecontent (title, content, filesendtime, filesendid, siteindex, systype, isown, z_type) value ('snowflake float, float ','

//////////////////////////////////////// ///////////////////////////////////
// According to an earlier file of turbine's predecessors, his class is used,
// I wanted to use classes for writing, but the as2 class is not familiar with it for the time being, and the mx class does not need to be used again,
// So I had to make it together and try it out first. A lot of code in it looks messy.
// Well, this is the first thing to do. It seems that you have to pay close attention to the usage of the learning class.
// No comments have been made. Sorry everyone. Who can help you comment out the comments and the comments will be worth some extra points...
// The source code will not be posted. You can copy all the code.
// Runtime environment flashMX2004
//////////////////////////////////////// ///////////////////////////////

Var sceneWidth = sceneHeight = 300;
Var sideDisWidth = Stage. width/2-sceneWidth/2;
Var sideDisHeight = Stage. height/2-sceneHeight/2;
Var snowNum = 80;
Var snowSpace: MovieClip = _ root. createEmptyMovieClip ("room", 1 );
Function addMasker (){
_ Root. createEmptyMovieClip ("masker", 10000 );
With (masker ){
BeginFill (0x000550,100 );
MoveTo (sideDisWidth, sideDisHeight );
LineTo (sideDisWidth + sceneWidth, sideDisHeight );
LineTo (sideDisWidth + sceneWidth, sideDisHeight + sceneHeight );
LineTo (sideDisWidth, sideDisHeight + sceneHeight );
LineTo (sideDisWidth, sideDisHeight );
EndFill ();
}
SnowSpace. setMask (masker );
CreateSnow ();
}
Function snowProperty (snow, w, h ){
Snow. _ x = sideDisWidth + Math. random () * w;
Snow. _ y = sideDisHeight + Math. random () * h;
Snow. _ rotation = Math. random () * 120 + 30;
Snow. stepX = Math. cos (snow. _ rotation * Math. PI)/180 );
Snow. stepY = Math. random () * 2 + 1;
SetInterval (snowFall, 30, snow );
}
Function drawSnow (snow: MovieClip, radius: Number ){
Var p = radius *. 9;
With (snow ){
Colors = [0 xCCCCCC, 0 xFFFFFF];
Alphas = [2, 100,100];
Ratios = [0,255];
Matrix = {matrixType: "box", x:-Math. random () * 2 * radius, y:-Math. random () * 2 * radius, w: 2 * radius, h: 2 * radius, r90/180) * Math. PI };
BeginGradientFill ("radial", colors, alphas, ratios, matrix );
MoveTo (0,-radius );
CurveTo (p,-p, radius, 0 );
CurveTo (p, p, 0, radius );
CurveTo (-p, p,-radius, 0 );
CurveTo (-p,-p, 0,-radius );
EndFill ();
}
SnowProperty (snow, sceneWidth, sceneHeight );
}
Function createSnow (){
Var n = 0;
While (n <snowNum ){
Var snow: MovieClip = snowSpace. createEmptyMovieClip ("s" + n, n );
Var radius: Number = Math. random () * 3;
DrawSnow (snow, radius );
N ++;
}
}
Function snowFall (snow ){
Snow. _ x + = snow. stepX;
Snow. _ y + = snow. stepY;
If (snow. _ x <sideDisWidth ){
Snow. _ x = sideDisWidth + sceneWidth;
}
If (snow. _ x> sideDisWidth + sceneWidth ){
Snow. _ x = sideDisWidth;
}
If (snow. _ y> sideDisHeight + sceneHeight ){
Snow. _ y = sideDisHeight;
}
}
AddMasker ();
_ Root. createEmptyMovieClip ("myMC", 10 );
With (myMC ){
LineStyle (1, 0 xcccccc, 100 );
MoveTo (sideDisWidth, sideDisHeight );
LineTo (sideDisWidth + sceneWidth, sideDisHeight );
LineTo (sideDisWidth + sceneWidth, sideDisHeight + sceneHeight );
LineTo (sideDisWidth, sideDisHeight + sceneHeight );
LineTo (sideDisWidth, sideDisHeight );
Var infor: TextField = myMC. createTextField ("infor", 1, sideDisWidth + sceneWidth-100, sideDisHeight + sceneHeight, 100, 20 );
Infor. autoSize = "right ";
Infor. selectable = false;
Infor. textColor = 0 xcccccc;
Infor. text = "by holybozo ";
}
_ Root. createEmptyMovieClip ("bg",-1 );
With (bg ){
BeginFill (0x999999,100 );
MoveTo (0, 0 );
LineTo (Stage. width, 0 );
LineTo (Stage. width, Stage. height );
LineTo (0, Stage. height );
LineTo (0, 0 );
EndFill ();
}

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.