Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Swish Tutorials Falling Star Field

Falling Star Field


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.



Author's URL: Craig Lowe
Final results of our readers
New!
Passed through all the steps? Share your result!
Your result will be premoderated.
Please make sure you choose the right image.
 
 



Captcha

*Required fileds
Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website. More Swish Tutorials: Featured Materials | Fresh Materials | More Swish Tutorials at FlashPerfection.com

No comments yet...
Add comments to "Falling Star Field"

Captcha