2 Replies Latest reply on Jan 7, 2009 8:44 AM by youngjon

    Toggle open/close Button

    youngjon
      Hi all,

      I have a small music player movie I am trying to make. So far I have an area that holds the track number and duration and just underlapping it I have a slide out menu which reveals play/stop and pause buttons.

      Currently it slides out on a rollOver rollOut function but I'd prefer a small button on the main area that toggles open/close ie: press to slide out the menu and press again to slide it back in.

      Currently I use the following entire code to facilitate the open/close of the menu as well as the play, pause, and stop buttons.

      Please tell me if I've made a complete hash of it or whether it can be easily done!

      [code]

      import mx.transitions.Tween;
      import mx.transitions.easing.Regular;

      var xOut = menu._x = 83.3;
      var xIn = 143.3;
      var easReg = Regular;

      menu.bg.onRollOver = function(){
      displayMenu();
      }

      menu.bg.onRollOut = function(){
      hideMenu();
      }

      menu.playBtn.onRollOver = function(){
      displayMenu();
      }

      menu.playBtn.onRollOut = function(){
      hideMenu();
      }

      menu.stopBtn.onRollOver = function(){
      displayMenu();
      }

      menu.stopBtn.onRollOut = function(){
      hideMenu();
      }

      menu.pauseBtn.onRollOver = function(){
      displayMenu();
      }

      menu.pauseBtn.onRollOut = function(){
      hideMenu();
      }

      function displayMenu(){
      var tw = new Tween(menu, "_x", easReg.easeInOut, menu._x, xIn, .5, true);
      }

      function hideMenu(){
      var tw = new Tween(menu, "_x", easReg.easeInOut, menu._x, xOut, .5, true);
      }

      Many thanks,

      J.