Example:
Open swishmax and add the following code to Scene_1.
|
onFrame (1) {
for (k=0; k<50; k++) { fall.duplicateSprite("fall"+k,k); } } |
Now create 4 seperate squares 4 x 4 pixels, and align them the width of the movie
Group together as a sprite, name the sprite fall and place at the top of the movie outside the work area, Add the following code to the sprite.
|
onLoad () {
movieWidth = 200; movieHeight = 250; i = 1+Math.random()*7; this._x = Math.random()*movieWidth; this._y = -5; } onEnterFrame() { this._y += i; if (this._y>=movieHeight) { this._y = -5; } if ((this._x>=movieWidth) || (this._x<=0)) { this._y = -5; } } |
That's it you have created a falling star field.
Press Ctrl+T to test your movie in player.

10 Random Swish Tutorials :
10 Random FlashPerfection.com Tutorials:





