0 Replies Latest reply on Dec 22, 2009 11:51 AM by 1flashnewbie

    Subnav not hiding

    1flashnewbie

      Problem: When I add an additional link to the Products drop-down, the bottom link text remains visible when the sub-nav hides. You'll see below where we tried to add a link to the Products drop-down.

       

      The current navigation is working. http://eric.iamagel.com/web/company_agel/package_def/lang_def/site/global/top_new.swf (only has 3 links in the drop-downs)

       

      I'm hoping somebody can look at the actionscript below and tell me which line needs to be changed so that all four links will hide when the sub-nav hides.

       

      Thank you in advance for your assistance.

       

       

      import mx.transitions.Tween;
      import mx.transitions.easing.*;
      import com.a5.PersonalInfo;
      stop();
      var tabs:Array = new Array("HOME","PRODUCTS", "COMPANY", "OPPORTUNITY", "JOIN THE TEAM");
      var numberOfTabs:Number = 5;
      var timeCount:Number = .1;
      var previousSubMenu:String;
      var subMenu:Array = new Array("Take the FREE Tour", "Join the Team", "Why I Love Agel");
      var subMenuURL:Array = new Array("/opportunity", "/join", "/testimonials.php");
      var subMenu2:Array = new Array("Gel Supplements", "GLO", "ageless Skincare", "Buy Now");
      var subMenu2URL:Array = new Array("/products/index.php", "/products/glo.php", "/products/skin_care.php", "/join/index.php");
      var subMenu3:Array = new Array("Our Story", "Executive Team", "Advisory Board");
      var subMenu3URL:Array = new Array("/company/our_story/brainwave.php", "/company/executive_team/index.php", "/company/advisory_board.php");
      var subMenu4:Array = new Array("Compensation Plan", "Success Stories", "Leadership", " ");
      var subMenu4URL:Array = new Array("/opportunity/comp_plan.php", "/opportunity/success_stories.php", "/opportunity/recognizing_leadership");
      //(userName == "sdaf") ? trace("Match!") : trace("No Match")
      // /opportunity/comp_plan.php
      // /opportunity/success_stories.php
      // /opportunity/recognizing_leadership


      //------personal info block ---------//

       

      var large_text:TextFormat = new TextFormat();
      large_text.color = 0x000000;
      large_text.font = "Arial";
      large_text.size = 16;
      large_text.align = "right";
      large_text.bold = true;

       

      var small_text:TextFormat = new TextFormat();
      small_text.color = 0x333333;
      small_text.font = "Arial";
      small_text.size = 12;
      small_text.bold = false;
      small_text.align = "right";

       

      var small_text_personalEmail:TextFormat = new TextFormat();
      small_text_personalEmail.color = 0x666666;
      small_text_personalEmail.font = "Arial";
      small_text_personalEmail.size = 12;
      small_text_personalEmail.bold = false;
      small_text_personalEmail.align = "right";
      small_text_personalEmail.url = "mailto:" + personalEmail;
      small_text_personalEmail.underline = true;

       

      var small_text_arrayEmail:TextFormat = new TextFormat();
      small_text_arrayEmail.color = 0x666666;
      small_text_arrayEmail.font = "Arial";
      small_text_arrayEmail.size = 12;
      small_text_arrayEmail.bold = false;
      small_text_arrayEmail.align = "right";
      small_text_arrayEmail.url = "/contact.php";
      small_text_arrayEmail.underline = true;

       

      var small_bold_text:TextFormat = new TextFormat();
      small_bold_text.color = 0x666666;
      small_bold_text.font = "Arial";
      small_bold_text.size = 14;
      small_bold_text.bold = false;
      small_bold_text.align = "right";

       

      /*
      var agelPersonalInfo = new PersonalInfo(right_box.personalInfo);

      agelPersonalInfo.items = [
      { id: 'yourName', label: yourName, type: 'text'},
      { id: 'compTitle', label: compTitle, type: 'text' },
      { id: 'address', label: address, type: 'text' },
      { id: 'phoneOne', label: phoneOne, type: 'text' },
      { id: 'arrayEmail', label: arrayEmail, type: 'text' },
      { id: 'personalEmail', label: personalEmail, type: 'text' }               
      ];
      agelPersonalInfo.spacing = 18;
      agelPersonalInfo.init();

       

      */
      right_box.personalInfo.yourName.setTextFormat(large_text);
      //right_box.personalInfo.yourName.embedFonts = true;
      right_box.personalInfo.yourName._y = personalInfo.yourName._y - 4;

       

      right_box.personalInfo.compTitle.setTextFormat(small_bold_text);
      //right_box.personalInfo.compTitle.embedFonts = true;

       

      right_box.personalInfo.address.setTextFormat(small_text);
      //right_box.personalInfo.address.embedFonts = true;

       

      right_box.personalInfo.phoneOne.setTextFormat(small_text);
      //right_box.personalInfo.phoneOne.embedFonts = true;

       

      right_box.personalInfo.arrayEmail.setTextFormat(small_text_arrayEmail);
      //right_box.personalInfo.arrayEmail.embedFonts = true;
      right_box.personalInfo.arrayEmail.html = true;
      right_box.personalInfo.arrayEmail.underline = true;

       

      right_box.personalInfo.personalEmail.setTextFormat(small_text_personalEmail);
      //right_box.personalInfo.personalEmail.embedFonts = true;
      right_box.personalInfo.personalEmail.html = true;
      right_box.personalInfo.personalEmail.underline = true;

       

      right_box.personalInfo.yourName._x = right_box.personalInfo.yourName._x - (600 - 190);
      right_box.personalInfo.compTitle._x = right_box.personalInfo.compTitle._x - (600 - 190);
      right_box.personalInfo.address._x = right_box.personalInfo.address._x - (600 - 190);
      right_box.personalInfo.phoneOne._x = right_box.personalInfo.phoneOne._x - (600 - 190);
      right_box.personalInfo.arrayEmail._x = right_box.personalInfo.arrayEmail._x - (600 - 190);
      right_box.personalInfo.personalEmail._x = right_box.personalInfo.personalEmail._x - (600 - 190);

       

      //-------------- end personal info block --------//

       


      function changeColor(tab, tState):Void {
      if(tState == "in") {
      colorchange = new Color(tab); 
      colorchange.setRGB(0x262626); 
      }
      else {
      colorchange = new Color(tab); 
      colorchange.setRGB(0x6AA837);
      }
      }

       

      function checkTabPosition(activeTab):Void {
      for(i=0; i<=4; i++) {
      if(eval("navbar.tab" + i)._y != tabPositionY && ["_level0.navbar.tab" + i] != activeTab) {
      new Tween(["_level0.navbar.tab" + i], "_y", Strong.easeOut, [navbar.tab + i]._y, tabPositionY, 1, true);
      eval("navbar.tab" + i)._y = -14;
      changeColor(eval("navbar.tab" + i).tab_bg, "out");
      /*trace("tab number " + i + " hit the function");
      trace("active tab is " + activeTab);
      trace("-----" + activeTab + "------");
      trace(eval("navbar.tab" + i)._y);
      trace(tabPositionY);
      trace(["navbar.tab" + i]);
      trace(activeTab);
      trace("-----------");*/
      }
      }
      }

       

      right_box.iName.text = userName;
      right_box.iEmail.text = userEmail;
      right_box.iPhone.text = userPhone;
      right_box.contact_me.onRelease = function() {
      getURL(contactURL, "_self");
      }

       

      for(i=0; i<=numberOfTabs; i++) {
      eval("navbar.tab" + i).tabName.text = tabs[i];
      if(eval("navbar.tab" + i).tabName.textHeight < 20) {
      eval("navbar.tab" + i).tabName._y = eval("navbar.tab" + i).tabName._y + 7;
      eval("navbar.tab" + i).cacheAsBitmap = true;
      }
      }
      right_box.imgLoader.loadMovie(imgURL);

       

      var tabPositionY = -14;
      navbar.tab0.onRollOver = function() {
      var tabOut = new Tween(navbar.tab0, "_y", Strong.easeOut, tabPositionY, tabPositionY + 10, .1, true);
      sSubMenu("in", navbar._x + this._x - 25, "subMenu", "subMenuURL");
      changeColor(this.tab_bg, "in");
      checkTabPosition(navbar.tab0);
      trace(navbar._x);
      trace(this._x);
      }
      navbar.tab0.onRollOut = function() {
      //var tabOut = new Tween(navbar.tab0, "_y", Strong.easeOut, navbar.tab0._y, tabPositionY, 1, true);
      //changeColor(this.tab_bg, "out");

      }
      navbar.tab0.onRelease = function() {
      getURL("/","_self");
      }

       

      Gel_Supplements.onRelease = function() {
      getURL("/opportunity","_self");
      }

       

      navbar.tab1.onRollOver = function() {
      var tabOut = new Tween(navbar.tab1, "_y", Strong.easeOut, tabPositionY, tabPositionY + 10, .1, true);
      sSubMenu("in", navbar._x + this._x - 35, "subMenu2","subMenu2URL" );
      checkTabPosition(navbar.tab1);
      changeColor(this.tab_bg, "in");
      }
      navbar.tab1.onRollOut = function() {
      //var tabOut = new Tween(navbar.tab1, "_y", Strong.easeOut, navbar.tab1._y, tabPositionY, 1, true);


      }
      navbar.tab1.onRelease = function() {
      getURL("/products","_self");
      }

      navbar.tab2.onRollOver = function() {
      var tabOut = new Tween(navbar.tab2, "_y", Strong.easeOut, tabPositionY, tabPositionY + 10, .1, true);
      sSubMenu("in", navbar._x + this._x - 50, "subMenu3", "subMenu3URL");

       

      checkTabPosition(navbar.tab2);
      changeColor(this.tab_bg, "in");
      }
      navbar.tab2.onRollOut = function() {
      //var tabOut = new Tween(navbar.tab2, "_y", Strong.easeOut, navbar.tab2._y, tabPositionY, 1, true);
      //changeColor(this.tab_bg, "out");
      }
      navbar.tab2.onRelease = function() {
      getURL("/company","_self");
      }

      navbar.tab3.onRollOver = function() {
      var tabOut = new Tween(navbar.tab3, "_y", Strong.easeOut, tabPositionY, tabPositionY + 10, .1, true);
      sSubMenu("in", navbar._x + this._x - 65, "subMenu4", "subMenu4URL");
      checkTabPosition(navbar.tab3);
      changeColor(this.tab_bg, "in");
      }
      navbar.tab3.onRollOut = function() {
      //var tabOut = new Tween(navbar.tab3, "_y", Strong.easeOut, navbar.tab3._y, tabPositionY, 1, true);
      //changeColor(this.tab_bg, "out");
      }
      navbar.tab3.onRelease = function() {
      getURL("/opportunity","_self");
      }

       

      navbar.tab4.onRollOver = function() {
      var tabOut = new Tween(navbar.tab4, "_y", Strong.easeOut, tabPositionY, tabPositionY + 10, .1, true);
      sSubMenu("out", -900, previousSubMenu, "");
      checkTabPosition(navbar.tab4);
      changeColor(this.tab_bg, "in");
      }
      navbar.tab4.onRollOut = function() {
      //var tabOut = new Tween(navbar.tab4, "_y", Strong.easeOut, navbar.tab4._y, tabPositionY, 1, true);
      //changeColor(this.tab_bg, "out");
      }
      navbar.tab4.onRelease = function() {
      getURL("/join","_self");
      }


      //trace(navbar.tab0.tabName.textHeight);
      //trace(navbar.tab1.tabName.textHeight);
      //trace(navbar.tab2.tabName.textHeight);
      //trace(navbar.tab3.tabName.textHeight);
      // Align the stage (Left Top)
      Stage.align = "LT";
      // prevent the Flash movie contents from resizing when the browser window changes size.
      Stage.scaleMode = "noScale";

       

      // create a listener object
      stageListener = new Object();
      // add a methods for it to do certain things when the Stage is resized by our user
      stageListener.onResize = function() {
      expandTop();
      }

       

      Stage.addListener(stageListener);

       

      expandTop = function () {
      bg._width = Stage.width;
      right_box._x = Stage.width;
      trace("right box width is " + right_box._width + " stage width is " + Stage.width + ":: right_box x is " + right_box._x);
      navbar._x = (Stage.width/2)-(navbar._width/2);
      };

       

      function dropNav() {
      var bgFI = new Tween(bg, "_alpha", Elastic.easeOut, 0, 100, 1, true);

      for(i=0; i<=numberOfTabs; i++) {
      //currentTab = eval("tab" + i);
      new Tween(eval("navbar.tab" + i), "_y", Strong.easeOut, eval("navbar.tab" + i)._y, -14, timeCount, true);
      //timeCount += .1;
      }
      }
      stageListener.onResize();

       


      dropNav();

       

      //TODO: make the submenu less lame
      //trace ("woot? " + this["subMenu"].length);
      function sSubMenu(sStatus, pos, menu, menuURL, tab):Void {
      previousSubMenu = menu;
      subSpace = navbar._y + 35; //this sets the nav y position based off the y position of the nav bar
      timer = .2;
      for (i=0; i<this[menu].length; i++) { //build the sub nav items pulled from the submenu array
      //createMenuItem(btn, sMenu[i])
      subSpace = subSpace+15;
      menuItem = this[menu][i];
      duplicateMovieClip("sm_btn", this[menu][i], i+20);
      eval(this[menu][i])._x = pos;
      //trace("this is the menu: " + menu);
      //trace("this is the menu position: " + pos);
      eval(this[menu][i]).btn_txt.mtxt.text = this[menu][i];
      if (sStatus == "in") {
      var xPosT:Tween = new Tween(eval(menuItem), "_y", Strong.easeOut, subSpace-25, subSpace, timer, true);
      var alphaT:Tween = new Tween(eval(menuItem), "_alpha", Strong.easeOut, 0, 100, 1, true);
      }
      if (sStatus == "out") {
      //var xPosT:Tween = new Tween(eval(menuItem), "_y", Strong.easeOut, eval(menuItem)._y, eval(menuItem)._y - 20, .3, true);
      var alphaT:Tween = new Tween(eval(menuItem), "_alpha", Strong.easeOut, 100, 0, .2, true);
      }
      //trace(i);
      eval(this[menu][i]).btnNum = i;
      eval(this[menu][i]).onRollOver = function() {
      //trace ("woot? " + eval(menu).length);
      for (j=0; j<= eval(menu).length; j++) {
      if (this.btnNum != j) {

       

      this[eval(menu)[j]+" myTempFilters"] = eval(sMenu[j]).filters;
      this[eval(menu)[j]+" myTempFilters"].push(myBlur);
      eval(eval(menu)[j]).filters = this[eval(menu)[j]+" myTempFilters"];
      var AlphaT:Tween = new Tween(eval(eval(menu)[j]), "_alpha", Strong.easeOut, eval(eval(menu)[j])._alpha, 50, 1, true);
      }
      else {
      this[eval(menu)[j]+" myTempFilters"] = eval(sMenu[j]).filters;
      this[eval(menu)[j]+" myTempFilters"].push(myGlow);
      eval(eval(menu)[j]).filters = this[eval(menu)[j]+" myTempFilters"];
      }
      }
      };
      eval(this[menu][i]).onRollOut = function() {
      for (j=0; j<=subMenu.length; j++) {
      var AlphaT:Tween = new Tween(eval(eval(menu)[j]), "_alpha", Strong.easeOut, eval(eval(menu)[j])._alpha, 100, 1, true);
      eval(eval(menu)[j]).filters = null;
      }
      };

      //trace("i = "+  i);
      eval(this[menu][i]).onRelease = function() {
      trace(this.btnNum);
      link = eval(menuURL)[this.btnNum];
      getURL(link, "_self");
      };
      //trace(space);
      timer += .1;
      }
      }

       

      function launchLink(linkToLaunch):Void {
      //trace(linkToLaunch);
      //getURL(linkToLaunch, "_self");
      }