Lebanon web design, development, hosting , seo, email marketing and E-commerce solutions
Snow Globe Effect PDF Print E-mail
User Rating: / 0
PoorBest 

This tutorial will demonstrate to you how to make a 3Kb swf that simulates a snow-globe effect. It is built from Jeff Edsell's version with modifications to increase simplicity and significantly decrease file size.

 

It's recommended that you know the basics of Flash. This tutorial has been separated into two parts (Preparation and ActionScript). In this tutorial, make your background a soft, dark color and you flakes white.

 

 


Let's begin:

1) Preparing the Clips

  • Insert a new movie clip symbol and call it "mc_snowglobe"
  • Make sure the registration point is on the upper left hand of "mc_snowglobe"
  • Within "mc_snowglobe", Make 6 new 40x40 movie clips to be your snowflakes (You can also use webdings size 40 font and convert them to symbols)
  • Name them "mc_flake1", "mc_flake2", and so on until "mc_flake6"
  • Make sure the registration point is on the upper left hand corner of the flakes
  • Drag one instance of each flake onto the stage and set at least one of their (x,y) coordinate positions to (0,0)
  • Name each instance in on the stage this fashion: "mc_flake1" as "flakeA_mc" all the way to "mc_flake6" as "flakeF_mc"

2) Acionscript

  • Insert a new layer above the snowflake layer and call it "A"
  • Open the ActionScript panel and enter this for frame1 of "A":

for (i=0;i<=15;i++) {
    duplicateMovieClip(flakeA_mc, "flakeA"+i, 6*i+0);
    duplicateMovieClip(flakeB_mc, "flakeB"+i, 6*i+1);
    duplicateMovieClip(flakeC_mc, "flakeC"+i, 6*i+2);
    duplicateMovieClip(flakeD_mc, "flakeD"+i, 6*i+3);
    duplicateMovieClip(flakeE_mc, "flakeE"+i, 6*i+4);
    duplicateMovieClip(flakeF_mc, "flakeF"+i, 6*i+5);
};

  • Click the instance of "flakeA_mc" and add this ActionScript:

onClipEvent (load) {
    change = Math.random()*2+1;
    scale = Math.random();
    randomposneg = Math.random();
    this._x = Math.random()*550;
    this._y = Math.random()*450;
    this._xscale = scale*85+15;
    this._yscale = scale*85+15;
    if (randomposneg<.5) {
        posneg = -1;
    } else {
        posneg = 1;
    }
}
onClipEvent (enterFrame) {
    if (this._y>=450) {
        change = Math.random()*2+1;
        this._y = -60;
    } else {
        this._y = this._y+change*this._width*this._width/2500;
        this._rotation = this._rotation+posneg*change;
    }
}

  • Add this ActionScript onto every other instance of a flake
  • Return to the main stage and test! You're done!

 
< Prev   Next >

Subscribe

Be alerted with news and updates at Lebvision.com