# AS trouble - trying to activate and deactivate buttons

**URL:** https://forum.kirupa.com/t/as-trouble-trying-to-activate-and-deactivate-buttons/161031
**Category:** flash
**Created:** [August 31, 2005, 2:26pm UTC](https://forum.kirupa.com/t/as-trouble-trying-to-activate-and-deactivate-buttons/161031 "2005-08-31T14:26:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![graylensman](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@graylensman](https://forum.kirupa.com/u/graylensman)
#### Post date: [August 31, 2005, 2:26pm UTC](https://forum.kirupa.com/t/as-trouble-trying-to-activate-and-deactivate-buttons/161031/1 "2005-08-31T14:26:50Z")

</div>

Here’s what I’m trying to do:

on the root level, I have two buttons to control the animation in a movie clip. At the start, the left-hand button is active, and the right hand button is inactive. This is no problem, I’ve got that worked out 😛

Click the left button, it starts the animation (an MC within an MC). This animation is timeline-based. What I want to happen, is when the mc animation reaches a specific point, the left button is deactivated and the right one is activated.

Here’s my script (which doesn’t work)

//NOTE: the midfame variable is declared in the shelfAnime movie clip!  
//set the upBtn state  
\_root.upBtn = false;  
//get the button to drop the shelves  
\_root.dropBtn.onRelease = function() {  
\_root.caseFlow.shelfAnime1.gotoAndPlay(“drop”);  
\_root.caseFlow.shelfAnime2.gotoAndPlay(“drop”);  
\_root.caseFlow.shelfAnime3.gotoAndPlay(“drop”);  
\_root.caseFlow.shelfAnime4.gotoAndPlay(“drop”);  
if (\_root.caseFlow.shelfAnime1.\_currentframe = \_root.caseFlow.shelfAnime1.midframe) {  
\_root.dropBtn = false;  
\_root.upBtn = true;  
};  
};  
//get the button to lift the shelves  
\_root.upBtn.onRelease = function() {  
\_root.caseFlow.shelfAnime1.gotoAndPlay(“lift”);  
\_root.caseFlow.shelfAnime2.gotoAndPlay(“lift”);  
\_root.caseFlow.shelfAnime3.gotoAndPlay(“lift”);  
\_root.caseFlow.shelfAnime4.gotoAndPlay(“lift”);  
if (\_root.caseFlow.shelfAnime1.\_currentframe \< \_root.caseFlow.shelfAnime1.midframe) {  
\_root.dropBtn = true;  
\_root.upBtn = false;  
}  
};

I’m attaching the sample fla, compressed in a zip archive.

Any ideas as to what I’m doing wrong? thanks!!
