PDA

View Full Version : Nav button states



escapist
December 17th, 2004, 06:47 PM
I have a menu with five nav buttons (atcually MovieClips). Each has three frame labels: "on", "stay", and "off". The rollover and rollout animations play flawlessly, but I'm at a loss as to how to give each button a sticky "active" state. I'd like the button to stay in it's active state until another button is clicked, then I would like it to play it's "off" animation.


Each MC has this code:



onClipEvent(load){
this.btnLabel_mc.btnLabel.text = this._name;
}
on (rollOver) {
this.gotoAndPlay("on");
}
on (rollOut) {
this.gotoAndPlay("off");
}
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = this._name;
_root.content.loadMovie(this._name+".swf");
} else if (_root.currMovie != this._name) {
if (_root.content._currentframe >= _root.content.midframe) {
_root.currMovie = this._name;
_root.content.play();
}
}
}



See the swf in action at:
www.jason-carlin.com (http://www.jason-carlin.com)

Thanks for your help

maximum_flash
December 18th, 2004, 02:48 AM
http://www.kirupaforum.com/forums/showthread.php?t=59925&highlight=active+state

i think that is what you are wanting.

son of light
December 21st, 2004, 03:39 AM
Looking at the way you are attempting this, you will need to create and call a function in the buttons _parent or containing clip that can loop through each button to see if their _name value == _root.currMovie value.
You will also need to create another variable like var "active" that you can set to true/false when a button is clicked.
The parent function loops through each button looking for
if(this._name != _root.currMovie && this.active = true)
{
// play "off"
// active = false
// other needed actions.
}


Then you can tell the button(s) to play their off frame.