Skip to main content
paulas88620265
Participating Frequently
March 28, 2018
Answered

problem with button and zoom on canvas

  • March 28, 2018
  • 1 reply
  • 431 views

hello ... I am working on a canvas project .. the project consists of an interactive map WITH ZOOM .. I have the symbol "map", inside this symbol I have the map and 2 buttons

button 1: go to frame 15
button 2: return to frame 1

the problem is that the zoom is superimposed on me with the buttons. The buttons are hidden ... when I go to frame 15 it shows me some special routes

I would like to take out the buttons of the "map" symbol and place it in the main scene

the problem

being the button 1 in the main scene I do not know how to take me to frame 15 of the "map" symbol

this code works if the button is inside the map symbol, but it does not work if the buttons are in the main scene, outside the map symbol



this.btn_boton1.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_2.bind (this));

function fl_ClickToGoToAndStopAtFrame_2 ()
{
this.gotoAndStop (15);
}


this.btn_boton2.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_3.bind (this));

function fl_ClickToGoToAndStopAtFrame_3 ()
{
this.gotoAndStop (1);
}

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Nice!

    Set their visibility in the beginning and when the user clicks the buttons.

    this.btn_boton1.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_2.bind(this));

    function fl_ClickToGoToAndStopAtFrame_2()

    {

         this.map.gotoAndStop(15); // it is in fact the 16th frame

         this.btn_boton1.visible = false;

         this.btn_boton2.visible = true;

    }

    this.btn_boton2.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_3.bind(this));

    function fl_ClickToGoToAndStopAtFrame_3()

    {

         this.map.gotoAndStop(1); // it is in fact the 2nd frame

         this.btn_boton1.visible = true;

         this.btn_boton2.visible = false;

    }

    this.btn_boton1.visible = true;

    this.btn_boton2.visible = false;

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    March 28, 2018

    Hi.

    Please try this:

    this.btn_boton1.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_2.bind(this));

    function fl_ClickToGoToAndStopAtFrame_2()

    {

         this.map.gotoAndStop(15); // it is in fact the 16th frame

    }

    this.btn_boton2.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_3.bind(this));

    function fl_ClickToGoToAndStopAtFrame_3()

    {

         this.map.gotoAndStop(1); // it is in fact the 2nd frame

    }

    Regards,

    JC

    paulas88620265
    Participating Frequently
    March 28, 2018

    thanks for answering and helping JoãoCésar

    yes, it works .. but it created another problem

    the "button2" is now always visible and before that button was hidden, it was shown only in frame 15

    how can I do to hide the "button2" in the main scene and activate it only by clicking on the "button1"

    and, when I click on the "button2" hide it to itself and go back to the frame 1

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    March 28, 2018

    Nice!

    Set their visibility in the beginning and when the user clicks the buttons.

    this.btn_boton1.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_2.bind(this));

    function fl_ClickToGoToAndStopAtFrame_2()

    {

         this.map.gotoAndStop(15); // it is in fact the 16th frame

         this.btn_boton1.visible = false;

         this.btn_boton2.visible = true;

    }

    this.btn_boton2.addEventListener ("click", fl_ClickToGoToAndStopAtFrame_3.bind(this));

    function fl_ClickToGoToAndStopAtFrame_3()

    {

         this.map.gotoAndStop(1); // it is in fact the 2nd frame

         this.btn_boton1.visible = true;

         this.btn_boton2.visible = false;

    }

    this.btn_boton1.visible = true;

    this.btn_boton2.visible = false;