# Strange framecontroll scripting

**URL:** <https://forum.kirupa.com/t/strange-framecontroll-scripting/62327>\
**Category:** flash\
**Created:** [August 26, 2004, 10:50pm UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327 "2004-08-26T22:50:22Z")\
**Posts on this page:** 5\
**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 26, 2004, 10:50pm UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327/1 "2004-08-26T22:50:22Z")

</div>

Hi!  
I use this code on my page:  
\*  
on(press) {  
\_root.play();  
\_root.gotoAndPlay(“studio\_in”);  
}  
\*  
When I press the button, it will play a fadeouteffect that’s positioned one frame after the currentframe.

1.It fades out the current shown image with _\_root.play();_  
2.It fades in the new image, with \*\_root.gotoAndPlay(“studio\_in”);

\*The problem is that it seems that it just runs \*\_root.gotoAndPlay(“studio\_in”); _and skipps the fadeout:_\_root.play();

\*If I just run _\_root.play();_[font=Arial] the fadeout works, but not if I run gotoAndPlay after the play() section. Howcome??

regards, henrik, sweden  
[/font]

---

<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:** [August 26, 2004, 11:46pm UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327/2 "2004-08-26T23:46:13Z")

</div>

It starts to play it, sees the gotoAndPlay and then does that. Try just play() and then at the end of the fadeout put the gotoAndPlay()

---

<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:** [August 26, 2004, 11:55pm UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327/3 "2004-08-26T23:55:44Z")

</div>

Ok, that makes sense. Though I can’t just put the gotoAndPlay() in the end of the fadeout, because depending of what button that’s pressed, the new image will be chosen, it won’t be the same everytime (it’s a menu I’m creating)

Maybe a while-function that runs play() as long as the fade-out last frame isn’t reached…

---

<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:** [August 27, 2004, 12:01am UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327/4 "2004-08-27T00:01:39Z")

</div>

Nope, didn’t work very well. The while-function just fuc\*ed things up. The script was warned to be to slow…

---

<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:** [August 27, 2004, 12:07am UTC](https://forum.kirupa.com/t/strange-framecontroll-scripting/62327/5 "2004-08-27T00:07:05Z")

</div>

Well, you could make the fadeout be a mc, and pass the mc a variable that it then moves the movie to, something like:

mc.goToFrame = “myframe”;  
mc.play();

and in the last frame of the mc:  
\_root.gotoAndPlay(goToFrame);

Its hard to tell if this will work without seeing your .fla though.
