Some readers have asked me how it was created the snowflake, so realistic, the Widget Christmas . Those who have downloaded the source you probably already know ... but it was really simple. First, I selected the Brush Tool in Flash and I drew a point.
![]() | ![]() |
I turned this into a symbol and I applied two effects in the right sequence: bevel and blur:
![]() | ![]() |
The result was: 
At this MovieClip (symbol) associated with a simple class I CNeve , which actually creates the intelligence of the staple itself:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | MovieClip { CNeve class extends MovieClip { _interval ; private var _interval; _maxy : Number ; private var _maxy: Number ; / / CNeve function () { this , "_move" , 25 ) ; _interval = setInterval (this, "_move", 25); round ( ( Stage . height + 256 ) / 2 ) + _getRndRange ( - 20 , - 7 ) ; _maxy = Math . round (( Stage . height + 256) / 2) + _getRndRange (- 20, - 7); } / / _getRndRange ( min : Number , max : Number ) : Number { private function _getRndRange (min: Number , max: Number ): Number { Number = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ; var randomNum: Number = Math . floor ( Math . random () * (max - min + 1)) + min; randomNum return; } / / _move ( ) { _move private function () { 1 , 5 ) ; _y + = _getRndRange (1, 5); _getRndRange ( - 50 , 50 ) ) > 0 ) ? 1 : - 1 ; _x + = ((_getRndRange (- 50, 50))> 0)? 1: - 1; 1 , 5 ) ; _rotation + = _getRndRange (1, 5); _y > _maxy ) { if (_y> _maxy) { _interval ) ; clearInterval (_interval); } ; updateAfterEvent (); } } |
The method _move() contains the intelligence of the staple, ie the function of fall, extremely simple. By varying the function random _x += ((_getRndRange(-50, 50))>0) ? 1 : -1;, si può aggiungere un effetto effetto vento, cioè i fiocchi cadono con una pendenza particolare. _x += ((_getRndRange(-50, 50))>0) ? 1 : -1;, for example by inserting a _getRndRange(-550, 50), you can add an effect wind effect, ie the flakes fall with a particular slope. In particular you can send the flakes to right and left using a code of this type:
1 | _getRndRange ( _getRndRange ( - 350 , - 50 ) , _getRndRange ( 50 , 350 ) ) ) > 0 ) ? 1 : - 1 ; _x + = ((_getRndRange (_getRndRange (- 350, - 50), _getRndRange (50, 350)))> 0)? 1: - 1; |
The rotation ( _rotation += _getRndRange(1, 5); ), then, confers a further detail to the same staple.
e uno scale randomico, per avere fiocchi di neve di diverse dimensioni. When I create a bow (see function creaFiocco() below) I also added an alpha=90 and a randomico stairs, to have snowflakes of different sizes.
1 2 3 4 5 6 7 8 9 10 11 12 | / / Create staple creaFiocco function () { 20 , 100 ) ; var s = randRange (20, 100); = randRange ( - Math . floor ( ( Stage . width - 320 ) / 2 ) , Math . round ( ( Stage . width + 320 ) / 2 ) ) ; var x = randRange (- Math . floor (( Stage . width - 320) / 2), Math . round (( Stage . width + 320) / 2)); = - Math . floor ( ( ( Stage . height - 256 ) / 2 ) ) - 10 ; var = y - Math . floor ((( Stage . height - 256) / 2)) - 10; "neve" , "neve_" + index , index , { _x : x , _y : y , _xscale : s , _yscale : s , _alpha : 90 } ) ; c_mc. attachMovie ("snow", "neve_" + index, index, {_x: x, _y: y, _xscale: s, _yscale: s, _alpha: 90}); index + +; index > 1000 ) { if (index> 1000) { ; index = 1; , 2 ) ; c_mc = createEmptyMovieClip ("c_mc", 2); } } |
And that's all ...
I forgot ... Best wishes to all and Happy Holidays ... ![]()














Check my site: http://www.Dieg0.com.ar
Regards,
Diego
@ Diego0: Thanks for links
On the site of Diego are also a JavaScript script that simulates the falling snowflakes. The advantage of using JavaScript is to be able to position the flakes above to our page, thing that with Flash - if on the one hand is possibiloe thanks to the transparency - prevents it from then in fact the selection.
Hello It should have come to browse on my blogghetto seeing you in MyBlogLog. I'm really ignorant about Flash and its surroundings, I did not know it was OOP action script. Who knows when I'll have a look, it appeals to me
Hello hello
@ Chris: Thanks for visiting! I saw that you're comentando in OO programming with C + +! Excellent choice. To address the concepts OO must surely be familiar with both the C and C + +. Actionscript is not as "pure" like C + +, although each version is getting closer to the real and "narrow" OO development methodologies. However if you can work with Flash, including Actionscript 2.0, you will surely find many things inspiring.
[...] Update: Service not available - See Create a snowflake in Flash [...]
"At this MovieClip (symbol) I associated CNeve a simple class that actually creates the intelligence of ...»
Have you started quickly and with very clear illustrations, then you've missed a bunch of essential information for a user "standard" as you create the class
CNeve? I saw how the symbol is associated, but I miss everything else. I manage very differently, but it is a pity.@ Claudio: What is not clear exactly? Sometimes it may seem that it skips a few details, however, considers that on the one hand some "basics" I have to take for granted, otherwise I should write a manual for each post, and you can find many other questions in previous posts that are still here, following for example the category ActionScript 3.0 or Flash . However the class
CNeveis associated with an empty MovieClip in the library via the Properties window. For details see, for example, Actionscript 3.0, all with the new operator . If more questions write me as well, so I'll be happy to answer tip.