1 Reply Latest reply on May 23, 2016 9:17 AM by ClayUUID

    Button in a movie clip which will command the Stage ?

    Erod63 Level 1

      Hi;

      Doc Canvas html5 type.

       

      What could be the code for a button (bt1_btn as instance name) which is in a movie clip (anim_mc as instance name), when the event on the button is "click" and the instruction is : make the Stage play (Stage which have been already stopped) ?

       

      Cause when i code the script in the stage level it works fine :

       

      this.stop();

       

       

      this.anim_mc.bt1_btn.addEventListener("click", letsGo.bind(this));

       

       

      function letsGo() {

        this.play();

      }

       

       

      But what i want is to write the code in the anim_mc clip :

       

      this.bt1_btn.addEventListener("click", letsGo.bind(this));

       

       

      function letsGo() {

      //what is the correct script here ? >>> Stage.play();

      }

       

      Thx

        • 1. Re: Button in a movie clip which will command the Stage ?
          ClayUUID Adobe Community Professional

          You don't play the stage. The stage is just a container object for everything else. What you want is to play the root (or main) timeline.

           

          To play the root timeline (or any timeline really) from anywhere, without having to worry about using relative references, parent.parent.parent etc, store a global reference to the timeilne. So on the first frame of the root timeline, put something like:

           

          thisIsTheRootTimeline = this;

           

          Then in the event handler, do this:

           

          thisIsTheRootTimeline.play();