# Senocular buttons

**URL:** https://forum.kirupa.com/t/senocular-buttons/297047
**Category:** Uncategorized
**Created:** [September 24, 2009, 7:49pm UTC](https://forum.kirupa.com/t/senocular-buttons/297047 "2009-09-24T19:49:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![thirdcherry](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@thirdcherry](https://forum.kirupa.com/u/thirdcherry)
#### Post date: [September 24, 2009, 7:49pm UTC](https://forum.kirupa.com/t/senocular-buttons/297047/1 "2009-09-24T19:49:30Z")

</div>

using senocular buttons for nested mc Buttons inside another clip that uses an onRollOver event to reveal the navigation

[http://www.senocular.com/flash/tutorials/buttoncapturing/](http://www.senocular.com/flash/tutorials/buttoncapturing/)

Has anyone been able to use the delegated HitTest method effectively for a nav?  
(maybe I’m just thinking too hard).

```auto
// last button saves last hitTest button
// for events like rollout etc.
buttons_mc.lastButton = null;

// findHitTestButton finds the button movie clip in
// buttons_mc that the mouse is over (using hitTest)
buttons_mc.findHitTestButton = function(){
    for (var mc in this){
        if (this[mc] instanceof MovieClip){
            if (this[mc].hitTest(_root._xmouse, _root._ymouse, true)){
                return this[mc];
            }
        }
    }
    return false;
}

// assign events to buttons_mc that are delegated
// to children by hitTest detection
buttons_mc.onPress = function(){
    trace("Menu onPress");
    this.lastButton = this.findHitTestButton();
    if (this.lastButton){
        this.lastButton.onPress();
    }
}
buttons_mc.onRelease = function(){
    trace("Menu onRelease");
    if (this.lastButton){
        this.lastButton.onRollOut();
    }
    this.lastButton = this.findHitTestButton();
    if (this.lastButton){

[COLOR=Red]// This is where the nav links would go[/COLOR]

        this.lastButton.onRelease();
    }
}

```

The problem is, using lastButton sets them all to the same link.  
How can I differentiate the links? I tried a switch case method, but did not work.  
i’m sure I’m missing something simple, but just cannot seem to connect the dots on this one. Thanks for your help!
