# Movie functions

**URL:** <https://forum.kirupa.com/t/movie-functions/120515>\
**Category:** Uncategorized\
**Created:** [August 25, 2004, 2:31am UTC](https://forum.kirupa.com/t/movie-functions/120515 "2004-08-25T02:31:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henxon](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@Henxon](https://forum.kirupa.com/u/Henxon)\
**Post date:** [August 25, 2004, 2:31am UTC](https://forum.kirupa.com/t/movie-functions/120515/1 "2004-08-25T02:31:28Z")

</div>

Hi

I need to do the following:

I press a button, and a image fades in. Pressing another button should first fade out the previous image, and fade in the image that belongs to the now pressed button. The fade in effect have I done in the main frames as a tween, and pressing the button looks like this:

\*on(press){  
\_root.gotoAndPlay(“producers\_in”);  
}

\*how do I _gotoAndPlay(“producers\_out”)_ before the next tweening starts at another frame? a _for_-loop and _playNextFrame_ or something? The pressed buttons needs to know what the previous loaded tween was, so it finishes the right one!

regards, henrik, sweden

---

<div class="post-metadata">

**Author:** ![newflavour](https://avatars.discourse-cdn.com/v4/letter/n/dbc845/32.png) [@newflavour](https://forum.kirupa.com/u/newflavour)\
**Post date:** [August 25, 2004, 4:27am UTC](https://forum.kirupa.com/t/movie-functions/120515/2 "2004-08-25T04:27:38Z")

</div>

you could always make your button call “producers\_out” and then make “producers\_out” call “producers\_in”.

another way would be to use setInterval() and create some sort of delay.
