2 Replies Latest reply on Nov 26, 2014 11:26 AM by Nipun Asthana

    Disable autostart on an html 5 canvas?

    jmflu Level 1

      I have a loop animation with a "Start" and "Stop" button.

       

      What I want is for the animation to open up and not start playing until they push start but then keep looping until they push stop.

       

      I have used the stop function on frame 1 but then it doesn't loop.  How can I have it not autoplay, but also loop unless the user clicks stop?

       

      (html 5 btw)

       

      Thank you!

        • 1. Re: Disable autostart on an html 5 canvas?
          ClayUUID Adobe Community Professional

          Why are you not able to use this.gotoAndPlay(1) on the last frame?

          • 2. Re: Disable autostart on an html 5 canvas?
            Nipun Asthana Adobe Employee

            This can be done as follows:

            Let the animation be placed within a Symbol on Stage

            Also there should be Start and Stop buttons on Stage.

             

            Give instance names to all of them in the Properties panel as:

            anim, btnStart, btnStop

             

            Open actions panel and write the below code and test movie:

             

            this.anim.stop();

            this.btnStart.addEventListener("click", fl_ClickToStart);

            this.btnStop.addEventListener("click", fl_ClickToStop);

            function fl_ClickToStart(e) {

                 exportRoot.anim.play();

            }

            function fl_ClickToStop(e) {

                 exportRoot.anim.stop();

            }

            1 person found this helpful