3 Replies Latest reply on Jul 17, 2007 3:45 PM by

    Pause/Play button states

      I am creating a custom video player for an ad and am trying to get the play/pause button to work correctly. I dragged an instance of the pause button to the stage with instance name "pause_but" and inside that movie clip created a second frame with the play button. Frame 1 has a frame label "pausestate" and the 2 frame has the play button with the frame label "playstate".

      My code is:

      var nc:NetConnection = new NetConnection();
      nc.connect("rtmp://cp22943.edgefcs.net/ondemand");
      var ns:NetStream = new NetStream(nc);

      //Buffer
      ns.setBufferTime(15);
      ns.onStatus = function(info){
      if(info.code == "NetStream.Buffer.Full"){
      bufferClip._visible = false;
      }
      if(info.code == "NetStream.Buffer.Empty"){
      bufferClip._visible = false;
      }
      }

      _root.video.theVideo.attachVideo(ns);
      ns.play("ads/rosenthalvideoad2");
      _global.ifplaying = true;
      trace(ifplaying);


      //Video Controls
      rewind_but.onRelease = function(){
      ns.seek(0);
      }

      play_but.onRelease = function(){
      ns.play();
      }


      if(ifplaying = true){
      pause_but.onRelease = function(){
      _root.pause_but.gotoAndStop("playstate");
      ns.pause();
      ifplaying = false;
      trace(ifplaying);
      }
      }
      if (ifplaying = false){
      pause_but.onRelease = function(){
      _root.pause_but.gotoAndStop("pausestate");
      ifplaying = true;
      trace(ifplaying);
      }
      }


      //Mute Button
      _root.createEmptyMovieClip("vSound", _root.getNextHighestDepth());
      vSound.attachAudio(ns);

      var so:Sound = new Sound(vSound);

      so.setVolume(100);

      mute_but.press = function(){
      if(so.getVolume() == 100){
      //this.gotoAndStop("onOver");
      so.setVolume(0);
      }
      else{
      //this.gotoAndStop("muteOver");
      so.setVolume(100);
      }
      }

      mute_but.onRollOut = function(){
      if(so.getVolume() == 100){
      this.gotoAndStop("on");
      }
      else{
      this.gotoAndStop("mute");
      }
      }

      mute.onRelease = function(){
      if(so.getVolume() == 100){
      so.setVolume(0);
      this.gotoAndStop("muteOver");
      }
      else{
      so.setVolume(100);
      this.gotoAndStop("onOver");
      }
      }
      stop();

      Can someone please try and help me solve this problem?