3 Replies Latest reply on Jul 5, 2010 3:09 PM by kglad

    where to put gotoAndPlay within a function

    fulfordsupply Level 1

      for reference: fulfordsupply.com/home.htm
      I will try to communicate this as simply as possible.

      On my first frame, I have:

      6 buttons (p1 through p6)

      A holder mc_holder, which holds mc_pages, {a movie clip that shows 6  pages (each their own movie clip, page1 though page6) tweened across  the screen, made to look as if the pages are being "flipped" through}

      The following code (thanks to DAWSONK):

      Code:
      stop();
      var _holder = mc_holder.mc_pages;
      var picked;
      p1.goal = 1;
      p1.onRelease = goPage;
      p2.goal = 10;
      p2.onRelease = goPage;
      p3.goal = 20;
      p3.onRelease = goPage;
      p4.goal = 30;
      p4.onRelease = goPage;
      p5.goal = 40;
      p5.onRelease = goPage;
      p6.goal = 50;
      p6.onRelease = goPage;

      function goPage() {
           _holder.goal = this.goal;
           _holder.onEnterFrame = function() {
                if (this.goal>this._currentframe) {
                     this.gotoAndStop(this._currentframe+1);
                } else if (this.goal<this._currentframe) {
                     this.gotoAndStop(this._currentframe-1);
                } else {
                     delete this.onEnterFrame;
                }
           };
      }

      }

      On each of the 6 pages, I have some animation.

       

      The problem is, as soon as the movie loads, ALL these animations begin  to play.  I am looking for a solution so that the animations will not  play until the page is viewed.

       

      I am thinking I can put a stop on the first frame of each page, and a  frame label ("go") on the second frame.

       

      Can I add this (my knowledge is limited but say... gotoAndPlay (go") )  to the code shown above? I have tried messing around with it but have  not yet had any results.

       

       

      Thanks in advance.