In this tutorial I will show you how to createa realistic looking star field effect using actionscript in flash
1.Create a small star of your choice. 2.Give it an instance name of
"star". 3.In the first frame give this actions:
numstars = 90; speed = 6; star_field = new Array (numstars); //x is x axis, y is y axis, z is speed of star
function star(x,y,speed) { this.x = x; this.y = y; this.speed = speed; } for (i=0;i { star_field[i] = new star(random(400),random(200),random(speed)+1); duplicateMovieClip ("star", "star_" add i, i+10); } function movestars() { for (i=0;i { star_field[i].x+= star_field[i].speed; if (star_field[i].x>400) { star_field[i].x = 0; } setProperty ("star_" add i , _x , star_field[i].x ) setProperty ("star_" add i , _y , star_field[i].y ) setProperty ("star_" add i , _alpha , star_field[i].speed*40 ) } } setInterval(movestars,10); [Download File][Page 1]Visit our forums to discuss / post your problems.