# Make this script only run for finite number of frames?

**URL:** <https://forum.kirupa.com/t/make-this-script-only-run-for-finite-number-of-frames/186623>\
**Category:** flash\
**Created:** [April 22, 2006, 10:56pm UTC](https://forum.kirupa.com/t/make-this-script-only-run-for-finite-number-of-frames/186623 "2006-04-22T22:56:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tientao](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@Tientao](https://forum.kirupa.com/u/Tientao)\
**Post date:** [April 22, 2006, 10:56pm UTC](https://forum.kirupa.com/t/make-this-script-only-run-for-finite-number-of-frames/186623/1 "2006-04-22T22:56:49Z")

</div>

Hello I am a total noob,

I saw this example script and got it to work, and I want to use it for only certain frames, but the effect it produces shows in every frame of my show. How can I make it only produce the effect in the frames I want? Thanks in advanced!

i = “1”;  
alpha = “0.8”;  
maxlight = “20”;  
while (Number(i)\<=Number(maxlight)) {  
duplicateMovieClip (“ray0”, “ray” add i, 800-i);  
setProperty ("/ray" add i, \_xscale, getProperty("/ray" add (i-1), \_xscale)+i_alpha);  
setProperty ("/ray" add i, \_yscale, getProperty("/ray" add (i-1), \_yscale)+i_alpha);  
setProperty ("/ray" add i, \_alpha, 10-i\*(0.5/50));  
i = Number(i)+1;  
}  
setProperty (“ray0”, \_visible, “0”);  
stop ();
