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/
Has anyone been able to use the delegated HitTest method effectively for a nav?
(maybe I’m just thinking too hard).
// 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!