Random blinking / twinkling stars in AS2

Hi there,

I would like to insert some blinking / twinkling / flashing (whatever you want to call it!) stars into the background of my flash banner and I’m a little unsure as to how to do it using code (as2) - can anyone help please?!

I would like a total of between 10 and 20 stars to appear randomly in a specific part of the background and I would like the alpha / transparency of each star to fade in and out independently.

I have found the following code which I believe does the job, however I am unable to get it working within my banner. If anyone has a suggestion or could recommend some other code it would be very much appreciated!

Here’s the code I’m trying to get to work…

[COLOR=#B1B100]for[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#000000]**var**[/COLOR][COLOR=#333333] i:[/COLOR][COLOR=#0066CC]Number[/COLOR][COLOR=#333333] = [/COLOR][COLOR=#CC66CC]0[/COLOR][COLOR=#333333]; i[/COLOR][COLOR=#66CC66]<[/COLOR][COLOR=#CC66CC]100[/COLOR][COLOR=#333333]; i++[/COLOR][COLOR=#66CC66])[/COLOR][COLOR=#66CC66]{[/COLOR]    [COLOR=#000000]**var**[/COLOR] clip:[COLOR=#0066CC]MovieClip[/COLOR] = space_mc.[COLOR=#0066CC]attachMovie[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#FF0000]"whiteStar"[/COLOR], [COLOR=#FF0000]"whiteStar"[/COLOR]+i, i[COLOR=#66CC66])[/COLOR];
    clip.[COLOR=#0066CC]_alpha[/COLOR] = [COLOR=#0066CC]Math[/COLOR].[COLOR=#0066CC]random[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#66CC66])[/COLOR][COLOR=#66CC66]*[/COLOR][COLOR=#CC66CC]100[/COLOR];
    clip.[COLOR=#0066CC]_x[/COLOR] = [COLOR=#0066CC]Math[/COLOR].[COLOR=#0066CC]random[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#66CC66])[/COLOR][COLOR=#66CC66]*[/COLOR][COLOR=#0066CC]Stage[/COLOR].[COLOR=#0066CC]width[/COLOR];
    clip.[COLOR=#0066CC]_y[/COLOR] = [COLOR=#0066CC]Math[/COLOR].[COLOR=#0066CC]random[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#66CC66])[/COLOR][COLOR=#66CC66]*[/COLOR][COLOR=#0066CC]Stage[/COLOR].[COLOR=#0066CC]height[/COLOR];
    clip.[COLOR=#006600]starAlpha[/COLOR]=[COLOR=#CC66CC]5[/COLOR];
    clip.[COLOR=#0066CC]onEnterFrame[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#66CC66]([/COLOR][COLOR=#66CC66])[/COLOR] [COLOR=#66CC66]{[/COLOR]
        [COLOR=#0066CC]this[/COLOR].[COLOR=#0066CC]_alpha[/COLOR] += [COLOR=#0066CC]this[/COLOR].[COLOR=#006600]starAlpha[/COLOR];
        [COLOR=#B1B100]if[/COLOR] [COLOR=#66CC66]([/COLOR][COLOR=#0066CC]this[/COLOR]._alpha[COLOR=#66CC66]>[/COLOR]=[COLOR=#CC66CC]100[/COLOR][COLOR=#66CC66])[/COLOR] [COLOR=#66CC66]{[/COLOR]
            [COLOR=#0066CC]this[/COLOR].[COLOR=#006600]starAlpha[/COLOR] = -[COLOR=#CC66CC]5[/COLOR];
        [COLOR=#66CC66]}[/COLOR]
        [COLOR=#B1B100]if[/COLOR] [COLOR=#66CC66]([/COLOR][COLOR=#0066CC]this[/COLOR]._alpha[COLOR=#66CC66]<[/COLOR][COLOR=#CC66CC]0[/COLOR][COLOR=#66CC66])[/COLOR] [COLOR=#66CC66]{[/COLOR]
            [COLOR=#0066CC]this[/COLOR].[COLOR=#006600]starAlpha[/COLOR] = [COLOR=#CC66CC]5[/COLOR];
        [COLOR=#66CC66]}[/COLOR]
    [COLOR=#66CC66]}[/COLOR]; [COLOR=#66CC66]}[/COLOR]