This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > November 2006 > navigation bar help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author navigation bar help
dasholbc

2006-11-19, 6:35 pm

I cannot get the images in my navigation bar to go from transparent when
inactive to solid when active. You can view the navigation bar at
www.okoboji.org. See attached code below. Please help!

// this function set the buttons in each section
// attaches buttons from the library based on the length of the arrays
// then set the behavior for each section and each button on click

function fMenu () {

// sections - - - - - - - - - -
for (var nSection=0; nSection < arrSections.length; nSection++) {

// construct name for current section
var sCurrentSection = _root["mc" + arrSections[nSection]];

// construct names for current arrays (titles and urls)
arrTitles = eval ("arr" + arrSections[nSection] + "_Titles" );
arrUrls = eval ("arr" + arrSections[nSection] + "_Urls" );

// add buttons for each section
for (var nButton=0; nButton < arrTitles.length; nButton++) {

// attach button | create name for the movie dynamic
sCurrentSection.attachMovie ("mcBtn_Id", "mcBtn" + nButton, nButton+2 );

// quick name for reference
var sShortName = sCurrentSection["mcBtn" + nButton];

// position
sShortName._x = 0;
sShortName._y = 35 + ( (sShortName._height * nButton) + 5);

// title
sShortName.txtTitle = arrTitles[nButton];

// pass url into the button
sShortName.sUrl = arrUrls[nButton];

// activate it as button
sShortName.onRelease = function () {

// disable this button
this.enabled = false;
this.gotoAndStop ("_down");

// enable last clicked button
_root.sLastButtonSelected.enabled = true;
_root.sLastButtonSelected.gotoAndStop ("_Up");

// new selected button
_root.sLastButtonSelected = this;

// return old section (if any) back to the bottom unless is it's the same
if (_root.sSectionSelected != this._parent) {

// move it down
fMoveSection (_root.sSectionSelected, "down");

// 'remember' new clicked section
_root.sSectionSelected = this._parent;

} // if

// call page | change '_blank' to the name of the window/frame you might
have (in case of a frameset html page
getURL(this.sUrl, "_self");

} // onRelease

// disable button for now
sShortName.enabled = false;

} // for

// - - - - -

// add behavior on section | do not show hand cursor on section, only on
buttons
sCurrentSection.mcBg.useHandCursor = false;

// pass section name in the section
sCurrentSection.sSectionName = arrSections[nSection];

sCurrentSection.mcBg.onRollOver = function () {
// move this section up
_root.fMoveSection (this._parent, "up");

// move any other section down if not selected
if (_root.sSectionSelected != _root.tempSectionUp && _root.tempSectionUp !=
this._parent) {
// move this section down
_root.fMoveSection (_root.tempSectionUp, "down");
} // if

// update temporary section up
_root.tempSectionUp = this._parent;

} // onRollOver

// make mcBG to act as button to move down sections
mcBg.useHandCursor = false;
mcBg.onRollOver = function () {

// move any other section down if not selected
if (_root.sSectionSelected != _root.tempSectionUp) {
// move this section down
_root.fMoveSection (_root.tempSectionUp, "down");
} // if

// update temporary section up
_root.tempSectionUp = undefined;

} // onRollOver


} // for

} // function

// move section up or down
// after the section park up or down, it will enable or disable the internal
buttons, so the user can select
// also it disables the mcBg in the section which I use as trigger for it

function fMoveSection (psd_Section, psd_Direction) {

if (psd_Direction == "up") {

// start moving on each frame
psd_Section.onEnterFrame = function () {

// check position
if (this._y <= 5) {

// disable mcBg of the section as a button
this.mcBg.enabled = false;

// activate buttons inside the section
_root.fButtons(this.sSectionName, "enable");

// park it and stop moving
this._y = 0;
delete this.onEnterFrame;

} else {

// continue moving
this._y -= -(0 - this._y)/2.8;

} // if

} // onEnterFrame

} else if (psd_Direction == "down") {

// start moving on each frame
psd_Section.onEnterFrame = function () {

// check position
if (this._y >= 160) {

// enable mcBg of the section as a button
this.mcBg.enabled = true;

// disable buttons inside the section
_root.fButtons(this.sSectionName, "disable");

// park it and stop moving
this._y = 165;
delete this.onEnterFrame;

} else {

// continue moving
this._y += (165 - this._y)/2.8;

} // if

} // onEnterFrame

} // if

} // function

// activate/diactivate buttons in a section

function fButtons (psd_SectionName, psd_Mode) {

// construct name for current section
var sCurrentSection = _root["mc" + psd_SectionName];

// construct names for current arrays (titles and urls)
arrTitles = eval ("arr" + psd_SectionName + "_Titles" );

if (psd_Mode == "enable") {

// loop through all buttons in that section
for (var nButton=0; nButton < arrTitles.length; nButton++) {

// enable button in the section
sCurrentSection["mcBtn" + nButton].enabled = true;

} // for


} else if (psd_Mode == "disable") {

// loop through all buttons in that section
for (var nButton=0; nButton < arrTitles.length; nButton++) {

// disable button in the section
sCurrentSection["mcBtn" + nButton].enabled = false;

} // for

} // if


}

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews