# \[flash 8\] custom button class help (newbie)

**URL:** <https://forum.kirupa.com/t/flash-8-custom-button-class-help-newbie/213637>\
**Category:** flash\
**Created:** [January 21, 2007, 10:08pm UTC](https://forum.kirupa.com/t/flash-8-custom-button-class-help-newbie/213637 "2007-01-21T22:08:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyecare](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@eyecare](https://forum.kirupa.com/u/eyecare)\
**Post date:** [January 21, 2007, 10:08pm UTC](https://forum.kirupa.com/t/flash-8-custom-button-class-help-newbie/213637/1 "2007-01-21T22:08:17Z")

</div>

Hi, I have a custom button class I need help with.

The class has 4 different cases which go to frame names  
onRollOver =\> goes to “over”  
onRollOut =\> goes to “normal”  
onPress =\> goes to “down”  
onRelease =\> goes to “inSection” (i.e. to show the user that they are in “that section”)

I am having problems with the last part. I want my button to look the way it does on the “inSection” part of the timeline, and to stay that way until the user selects a different section. Then I want that particular button to go back to “normal” (since they aren’t in “that section” anymore)

I’m also wondering if this approach is a bad idea, because I have other functions that happen on the main timeline, outside of this class when the movie clip has a “onRelease” event (i.e. loads a clip).

Can anyone help?

Here is the code below:

[COLOR=Black]\*\*class menuButton extends MovieClip {  
private var menuText:MovieClip;  
private var menuLabel:String;

```
private var section:Boolean = false;

function menuButton(menuLabel) {
    init();
}
private function init(menuLabel):Void {
    menuText.buttonText.text = menuLabel;
}
private function onRollOver():Void {
    if (section == false) {
    this.gotoAndPlay("over");
    }
}
private function onRollOut():Void {
    if (section == false) {
    this.gotoAndPlay("normal");
    }
}
private function onPress():Void {
    if (section == false) {
    this.gotoAndStop("down");
    }
}
private function onRelease():Void {
    if (section == false) {
    this.gotoAndStop("inSection");
    section = true;
    } else {
        this.gotoAndPlay("normal");
        section = false;
        }
}

```

}\*\*[/COLOR]
