Skip to main content
Participating Frequently
April 14, 2020
Question

Button inside a movie clip - HTML5

  • April 14, 2020
  • 1 reply
  • 326 views

Hello guys!
I have this code below in button within 1 movie clip:

this.opcao_1.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_11.bind(this));

function fl_ClickToGoToAndPlayFromFrame_11()
{
	this.gotoAndPlay(150);

When I test the film, the button does not advance to the frame.
Could someone help me?

    This topic has been closed for replies.

    1 reply

    Community Expert
    April 15, 2020

    You need to give your movieclip an instance name.

    here is an example.


    /* Click to Go to Frame and Play
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
    Can be used on the main timeline or on movie clip timelines.

    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    2.Frame numbers in EaselJS start at 0 instead of 1
    */

    this.ball.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));

    function fl_ClickToGoToAndPlayFromFrame()
    {
    this.gotoAndPlay(150);
    }