# Problem with setInterval(). Help! please

**URL:** <https://forum.kirupa.com/t/problem-with-setinterval-help-please/113464>\
**Category:** Uncategorized\
**Created:** [June 18, 2004, 6:53am UTC](https://forum.kirupa.com/t/problem-with-setinterval-help-please/113464 "2004-06-18T06:53:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mx\_guest2004](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@mx\_guest2004](https://forum.kirupa.com/u/mx_guest2004)\
**Post date:** [June 18, 2004, 6:53am UTC](https://forum.kirupa.com/t/problem-with-setinterval-help-please/113464/1 "2004-06-18T06:53:56Z")

</div>

Hi!  
I have this code to load an external swf and changing it’s \_alpha.  
Problem is that the function doesn’t works on the clip.  
mx-guest2004  
[AS]  
\_root.createEmptyMovieClip(“butt”,21);  
loadMovie(“photobutton.swf”, “butt”);  
setProperty(“butt”, \_alpha, 0);  
function reAlpha(clip, targ, speed) {  
if (clip.\_alpha\<targ) {  
clip.\_alpha += speed;  
} else {  
clearInterval(reAlphaInt);  
}  
}  
reAlphaInt = setInterval(reAlpha, 20, butt, 100, 5);  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 18, 2004, 7:58am UTC](https://forum.kirupa.com/t/problem-with-setinterval-help-please/113464/2 "2004-06-18T07:58:09Z")

</div>

Change the alpha **after** the swf is fully loaded;)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 18, 2004, 8:19am UTC](https://forum.kirupa.com/t/problem-with-setinterval-help-please/113464/3 "2004-06-18T08:19:28Z")

</div>

Thanks Scotty, the button works now. But I have another problem with the same code inside the button.  
You know, I think there is something with the path.  
I have a button loaded into the main movie (OK). This button loads an external swf into the main movie. I want to increase this external swf’s \_alpha by this code.  
I use this code:  
[AS]  
on (release) {  
\_root.createEmptyMovieClip(“album”, 1);  
\_root.album.loadMovie(“mymovie.swf”);  
setProperty(“album”, \_alpha, 0);  
function reAlpha(clip, targ, speed) {  
if (clip.\_alpha\<targ) {  
\_parent.clip.\_alpha += speed;  
} else {  
clearInterval(reAlphaInt);  
}  
}  
setInterval(reAlpha, 20, album, 100, 5);  
}  
[/AS]
