Skip to main content
Participating Frequently
March 1, 2018
Answered

Simple buttons on a simple map (from a simple mind:)

  • March 1, 2018
  • 4 replies
  • 305 views

Hello, I realize an interactive map of Morocco on Animate. About ten cities are pointed with, for each of them, a supposed button to reveal a small histogram. The code for the first city works normally : in the click the histogram appears correctly. On the other hand, the following city, with the same code (but names of ocurrence different) stops working.

Does anybody know the principle of coding the best adapted in this case? Thank you in advance for the answer. (May be an answer in french?:) 

For information here is code i used 

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer kglad

    the first problem i see is both buttons are calling the same function.  that can't be correct.

    use different function names (eg, mrrakechF and cazablancaF) in the listener and function definition.

    4 replies

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    March 1, 2018

    the first problem i see is both buttons are calling the same function.  that can't be correct.

    use different function names (eg, mrrakechF and cazablancaF) in the listener and function definition.

    Participating Frequently
    March 1, 2018

    Thank you Kglad for your help.

    I'll try to night (after work) new function names. I am unfortunately not very talented in coding. If I understood you, I may try something like that ? :

    this.bt_marrakech.addEventListener("click",mrrakechF .bind(this));

    function mrrakechF( )

    {

    this.graph_marrakeche.play( )

    }

    kglad
    Community Expert
    Community Expert
    March 1, 2018

    yes.