I have used the following code to build a starfield:
starfield.star._visible = 0;
initx = starfield._x;
inity = starfield._y;
_root.onEnterFrame = function() {
with (starfield) {
_x += (horizfader._x-horizfader.initx)/15;
_y += 2
// loop the starfield
if (_x>initx+1100) {
_x = initx;
}
if (_x<initx) {
_x = initx+1100;
}
if (_y>inity+400) {
_y = inity;
}
if (_y<inity) {
_y = inity+400;
}
}
};
generate.onRelease = function() {
for (i=1; i<=2000; i += 4) {
for (a=0; a<=3; a++){
duplicateMovieClip(starfield.star, “star”+(i+a), i+a);
if (i%7 == 0) {
starfield[“star”+(i+a)]._xscale = 40;
starfield[“star”+(i+a)]._yscale = 40;
}
}
starfield[“star”+i]._x = Math.floor(Math.random()*1100);
starfield[“star”+i]._y = Math.floor(Math.random()*400);
starfield[“star”+(i+1)]._x = starfield[“star”+i]._x-1100;
starfield[“star”+(i+1)]._y = starfield[“star”+i]._y;
starfield[“star”+(i+2)]._x = starfield[“star”+i]._x-1100;
starfield[“star”+(i+2)]._y = starfield[“star”+i]._y-400;
starfield[“star”+(i+3)]._x = starfield[“star”+i]._x;
starfield[“star”+(i+3)]._y = starfield[“star”+i]._y-400;
}
};
NOW, how do i make those stars twinkle randomly. I am betting it involves the math class and alpha class, however i am relativley still new to actionscript. any suggestions?