# gotoAndPlay not working correctly

**URL:** <https://forum.kirupa.com/t/gotoandplay-not-working-correctly/265818>\
**Category:** flash\
**Created:** [July 12, 2008, 10:47pm UTC](https://forum.kirupa.com/t/gotoandplay-not-working-correctly/265818 "2008-07-12T22:47:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bossos](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@Bossos](https://forum.kirupa.com/u/Bossos)\
**Post date:** [July 12, 2008, 10:47pm UTC](https://forum.kirupa.com/t/gotoandplay-not-working-correctly/265818/1 "2008-07-12T22:47:13Z")

</div>

Hi,

I’m trying to get a some flash movieclips to fade in and fade out again on mouse Rollover / out events. The rollover and fade up works fine, but the rollout just skips directly back to frame 1 without playing the bit I tell it to.

Heres the movieclip timeline and code:

![](http://forum.kirupa.com/uploads/kirupa/4843/5e190791491fb5df.jpg)

I have stop() commands at the start and middle frames

```auto

mainBar.arenaClip.addEventListener(MouseEvent.ROLL_OVER, colorImage);
mainBar.arenaClip.addEventListener(MouseEvent.ROLL_OUT, fadeImage);
mainBar.shoeClip.addEventListener(MouseEvent.ROLL_OVER, colorImage);
mainBar.shoeClip.addEventListener(MouseEvent.ROLL_OUT, fadeImage);
mainBar.adClip.addEventListener(MouseEvent.ROLL_OVER, colorImage);
mainBar.adClip.addEventListener(MouseEvent.ROLL_OUT, fadeImage);

function colorImage(event:MouseEvent):void
{
	event.target.gotoAndPlay(event.target.colorIt);
}

function fadeImage(event:MouseEvent):void
{
	event.target.gotoAndPlay(event.target.fadeIt);
}

```

Like I say, colorIt bit works fine, but the fading down just skips back to the first frame without ever playing the fadeIt bit. Have confirmed with trace statements that the Event is triggering correctly.

Any help would be much appreciated!

---

<div class="post-metadata">

**Author:** ![Bossos](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@Bossos](https://forum.kirupa.com/u/Bossos)\
**Post date:** [July 13, 2008, 7:17am UTC](https://forum.kirupa.com/t/gotoandplay-not-working-correctly/265818/2 "2008-07-13T07:17:50Z")

</div>

Managed to get it working. For some reason it doesn’t work with the labels I have set, but if I use the frame number as below:

```auto
function colorImage(event:MouseEvent):void
{
	event.target.gotoAndPlay(2);
}

function fadeImage(event:MouseEvent):void
{
	event.target.gotoAndPlay(12);
}

```

It works fine… does that mean Frame Labels are purely cosmetic or do you need to set them up a certain way in their properties?

---

<div class="post-metadata">

**Author:** ![Lachhh](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Lachhh](https://forum.kirupa.com/u/Lachhh)\
**Post date:** [July 14, 2008, 3:49pm UTC](https://forum.kirupa.com/t/gotoandplay-not-working-correctly/265818/3 "2008-07-14T15:49:16Z")

</div>

I don’t know if it’s for that, but here’s my guess

event.target.colorIt == ?  
It is equals to mainBar.arenaClip.colorIt which is probably not set, i ithink what you were trying was  
event.target.gotoAndPlay(“colorIt”);

I expect that event.target.colorIt was equals to null, which make  
event.target.gotoAndPlay(null);  
which makes… something… bad… and… unexpected…

Hopes that it helps

Lachhh
