1 Reply Latest reply on Jun 5, 2009 9:38 AM by esco1313

    if ...and if...??

    esco1313 Level 1

      heya!

       

      i'm coding buttons..

      i need to use an if statement. actually, i need more than 1 in each button. Is there a special way to do it? because the way i did it doesnt seem to work properly:

       

      if (newsMc._visible != true) {
              var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
              var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
              var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
              newsMc._visible = false;
              screen._visible = true;
              screenfadeIn.start();
                 
              }
          else {
              newsfadeOut.start();
              var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
              var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
              var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
              newsfadeOut.onMotionFinished=function(){
                  newsMc._visible = false;
                  screen._visible = true;
                  screenfadeIn.start();
              }
          }
          if (aboutSectionMc._visible != true) {
              var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
              var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
              var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
              newsMc._visible = false;
              aboutSectionMc._visible = false;
              screen._visible = true;
              screenfadeIn.start();
                 
              }
          else {
              aboutSectionfadeOut.start();
              var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
              var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
              var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
              aboutSectionfadeOut.onMotionFinished=function(){
                  aboutSectionMc._visible = false;
                  newsMc._visible = false;
                  screen._visible = true;
                  screenfadeIn.start();
              }
          }

        • 1. Re: if ...and if...??
          esco1313 Level 1

          well now... i think i just discovered the ELSE IF....:D

           

          if (newsMc._visible == true) {
                  newsfadeOut.start();
                  var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
                  var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
                  var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
                  newsfadeOut.onMotionFinished=function(){
                      newsMc._visible = false;
                      screen._visible = true;
                      screenfadeIn.start();
                  }
              }
             
              else if (aboutSectionMc._visible == true) {
                  aboutSectionfadeOut.start();
                  var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
                  var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
                  var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
                  aboutSectionfadeOut.onMotionFinished=function(){
                      newsMc._visible = false;
                      screen._visible = true;
                      screenfadeIn.start();
                  }
              }
                  /*else if (aboutSectionMc._visible != true) {
                  var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
                  var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
                  var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
                  newsMc._visible = false;
                  aboutSectionMc._visible = false;
                  screen._visible = true;
                  screenfadeIn.start();
                     
                  }*/
              else {
                  var menuTween:Tween = new Tween (menuMc,"_x",Regular.easeInOut,menuMc._x,150,.75,true);
                  var contentsTween:Tween = new Tween (contentsMc,"_x",Regular.easeInOut,contentsMc._x,150,.75,true);
                  var contactMainMcTween:Tween = new Tween (contactMainMc,"_x",Regular.easeInOut,contactMainMc._x,150,.75,true);
                      newsMc._visible = false;
                      screen._visible = true;
                      screenfadeIn.start();
                  }
              }

           

          thanks anyways;)