1 Reply Latest reply on Feb 21, 2007 9:02 PM by kglad

    Problems Overriding setInterval with Button onRelease

    Steelers
      Hi.

      I'm successfully jumping between playing Frame 1 and Frame 2 using the functions below and setIntervals ...

      ( The following code is in Frame 1 main timeline ... )

      stop();

      / / this advances to the next frame
      var myInterval:Number;
      function proceed() {
      nextFrame();
      clearInterval(myInterval);
      }

      myInterval = setInterval(proceed,15000);




      // The code below is in Frame 2 of the main timeline

      stop();

      // the following function goes back a frame
      var myInterval:Number;
      function receed() {
      clearInterval(myInterval);
      prevFrame();


      }

      myInterval = setInterval(receed,9000);




      Everything gets all jacked up when I try and add a button to escape the flipping between Frame 1 and 2 and jump to Frame 5. My button is in frame 1. The following script is on Frame 1 of main Timeline and instead of going to Frame 5 when the button is pressed it just goes to the Next Frame (not overriding setInterval??)

      //FLASH GLOSSY BUTTON
      //designed and developed by iulian.dima@gmail.com
      import mx.transitions.Tween;
      import mx.transitions.easing.*;

      //functions used for the event handlers
      function over(){
      var myTween:Tween = new Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,50,2,true);
      }
      function out(){
      var myTween:Tween = new Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,0,2,true);
      }
      function press(){
      this._y +=3;
      this._x +=3;

      }

      // Want to go to Frame 5 on release of button ...
      function release(){
      this._y -=3;
      this._x -=3;
      clearInterval(myInterval);
      gotoAndPlay("5");
      }
      function releaseoutside(){
      var myTween:Tween = new Tween(this.btn_mask,"_alpha",Strong.easeOut,this.btn_mask._alpha,0,2,true);
      this._y -=3;
      this._x -=3;
      }

      //button1 events
      btn1.onRollOver = over;
      btn1.onRollOut = out;
      btn1.onPress = press;
      btn1.onRelease = release;
      btn1.onReleaseOutside = releaseoutside;




      Any suggestions?

      Sincerely,
      Paul Cross