2 Replies Latest reply on Nov 27, 2007 4:20 PM by Craig Grummitt

    Problem with function toggle

    Brenton07
      Hello,
      I'm working on a player and am having some issues getting my play pause toggle to work as I would like it to. The basic idea is when I run "ns.play", I will run a function and pass "play". When the function runs, it would take "play" and make the pause button, videoControl.control2, invisible. videoControl is a movieclip on the root and control7 is the movieclip inside of it that is the pause button
        • 1. Re: Problem with function toggle
          robdillon Most Valuable Participant
          how about something like this instead:

          var playOrPause:Boolean = false;

          function playSong():Void
          {
          ns.play(" http://domain/file.flv")
          playOrPause = true;
          togglePlayPause();
          }



          togglePlayPause = function()
          {
          switch(playOrPause) {
          case true :
          videoControl.control2._visible = true;
          videoControl.control7._visible = false;
          break;

          case false :
          videoControl.control7._visible = true;
          videoControl.control2._visible = false;
          break;
          }
          }
          • 2. Re: Problem with function toggle
            Craig Grummitt Level 3
            it's probably a good idea to give your play and pause buttons more obvious instance names, such as "play" and "pause" rather than control2 and control7. even in your explanation, there is some confusion - you call the pause button both 'control2' and 'control7'. confusion could easily be also in your code!