# \[CS3\]\[AS2\] Button trouble!

**URL:** <https://forum.kirupa.com/t/cs3-as2-button-trouble/280027>\
**Category:** Uncategorized\
**Created:** [January 21, 2009, 8:03pm UTC](https://forum.kirupa.com/t/cs3-as2-button-trouble/280027 "2009-01-21T20:03:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jet71dl](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jet71dl](https://forum.kirupa.com/u/jet71dl)\
**Post date:** [January 21, 2009, 8:03pm UTC](https://forum.kirupa.com/t/cs3-as2-button-trouble/280027/1 "2009-01-21T20:03:49Z")

</div>

I am having trouble with my buttons, they work perfectly, do what they are supposed to do. I am using this code for my buttons:

```auto

choco1.visited = false;
choco1.onRollOver = function()
{
  this.gotoAndStop("over");
}
choco1.onRollOut= function()
{
   if(this.visited) this.gotoAndStop("visited");
else this.gotoAndStop("up");
}
choco1.onRelease= function()
{
  this.gotoAndStop("over");
this.visited = true;
}
choco1.onPress= function()
{
  this.gotoAndStop("down");
  gotoAndPlay('1');
}

//-----------------------------------------------------

choco2.visited = false;
choco2.onRollOver = function()
{
  this.gotoAndStop("over");
}
choco2.onRollOut= function()
{
   if(this.visited) this.gotoAndStop("visited");
else this.gotoAndStop("up");
}
choco2.onRelease= function()
{
  this.gotoAndStop("over");
this.visited = true;
}
choco2.onPress= function()
{
  this.gotoAndStop("down");
  gotoAndPlay('2');
}
....

```

When you click on the movie clip it goes to another frame and an animation plays,

THE PROBLEM: When it goes to the animation frame after clicking the button, you are still able to click the button even though the buttons are behind the animation that is playing…how would i go about disabling the buttons while it is on the animation frame but also keep the visited state of the button clicked?

Thank You.
