I've built these website menu buttons and used some ActionScript 2.0 code i ran through in a tutorial on MovieClip Buttons. Trouble is, I need to adjust the AS to link the buttons (on click) to load external movieclips which contain galleries and another menu. With the AS code i've got, it links to the last external movieclip specified in my "if else" statements for each of the 3 buttons - i need it to link to only the external movieclip that corresponds to the button that is currently selected. I think there's something I'm missing. Here is the full code. The section i'm concerned about is the Bolded "doClick function" text below that contains the code I'm unsure about. Any help is appreciated. Thanks.
var groupinfo:Array = [button_Ad, button_Website, button_Logo];
// create constants to define start and stop of fadein and fadeout sequences
// (fadeout should be exactly the same sequence as fadein, in reverse frame order)
var FADEINSTART:Number = 3;
var FADEINSTOP:Number = 9;
var FADEOUTSTART:Number = 10;
var FADEOUTSTOP:Number = 16;
// create a variable to track the currently selected button
var activebtn:MovieClip;
activebtn=button_Ad
// doRollOver: start the rollover action or process,
// unless the button is currently selected
function doRollOver() {
if (this != activebtn) {
// if fading out, send to corresponding frame in fadein
if (this._currentframe > FADEOUTSTART && this._currentframe < FADEOUTSTOP) {
this.gotoAndPlay(FADEINSTART + FADEOUTSTOP - this._currentframe)
} else {
this.gotoAndPlay(FADEINSTART);
}
}
}
// doRollOut: start the rollout action or process,
// unless the button is currently selected
function doRollOut() {
if (this != activebtn) {
// if fading in, send to corresponding frame in fadeout
if (this._currentframe > FADEINSTART && this._currentframe < FADEINSTOP) {
this.gotoAndPlay(FADEOUTSTART + FADEINSTOP - this._currentframe);
} else {
this.gotoAndPlay(FADEOUTSTART);
}
}
}
// doClick: 1) save a reference to previously active button, 2) update activebtn,
// 3) turn off previously active, 4) turn on current active
function doClick() {
var prevbtn:MovieClip= activebtn;
activebtn = this; // update pointer to current selection
prevbtn.onRollOut(); // return previously selected to normal
this.gotoAndStop(1);
[B]if(this= button_Ad) {
secondaryMenu_mc!='ImageGallery_WebAndPrint_FlashMenu.swf';
secondaryMenu_mc.loadMovie('ImageGallery_WebAndPrint_FlashMenu.swf');
} else
if(this= button_Website) {
secondaryMenu_mc!='ImageGallery_WebAndPrint_GIFMenu.swf';
secondaryMenu_mc.loadMovie('ImageGallery_WebAndPrint_GIFMenu.swf');
} else
if(this= button_Logo) {
secondaryMenu_mc!=('ImageGallery_WebAndPrint_GIFMenu2.swf');
secondaryMenu_mc.loadMovie('ImageGallery_WebAndPrint_GIFMenu2.swf');
}
}[/B]
// assign functions to each event for each button in the group
function init() {
for (var mc in groupinfo) {
groupinfo[mc].onRollOver = doRollOver;
groupinfo[mc].onRollOut = doRollOut;
groupinfo[mc].onRelease = doClick;
}
}
init();