Wednesday, January 21, 2004

Not sure how useful this will be to anyone, but I have found myself using it a few times now. I found I was repeating code a lot so created the following function to toggle buttons in Flash MX:

function toggleSubNav(mc) {
lastMC.gotoAndStop("off");
lastMC.toggled = false;
mc.gotoAndStop("toggled");
mc.toggled = true;
lastMC = mc;
}

myBtn.onRelease=function() {
if (!this.toggled) {
toggleSubNav(this);
}
}

As long as you create button movieclips with frames labelled "toggled" and "off" depicting the two states it should work!

Jon 2:20 PM Permalink

Comments:

Post a Comment