listenerwechsel

FriedrichLaher shared this question 2 weeks ago
Answered

nimm den Code als "bei Mousklick" Code eines beliebigen Objects x,


klicke x EINmal, dann amdere, codleere Objecte. Nachdem L3 ausgegeben wurde

sollte der nächste Klick eigendelich L0 ausgeben, bleibt aber ganz ohne

Anzeige.

c = alert; // wenn online natürlich lieber
           // console.log
function L0() {
  ggbApplet.registerClickListener('L1');
  c('L0');

}
function L1() {
  ggbApplet.unregisterClickListener('L1');
  ggbApplet.registerClickListener('L2');
  c('L1');
}
function L2()
{
  ggbApplet.unregisterClickListener('L2');
  ggbApplet.registerClickListener('L3');
  c('L2');
}
function L3()
{
  ggbApplet.unregisterClickListener('L3');
  ggbApplet.registerClickListener('LO');
  c('L3');
}

L0();

Comments (5)

photo
1

daß auch L0 noch ein unregister benötigt ist mir "schon gekommen", klappt dann aber trotzdem nicht

photo
1

Please post a link to your working .html

photo
1

changingListener

1st click A then 4 times B ; expected L0,L1,L2,L3,L0,... but after 1st time L3 no more output is produced


c =  console.log
function L0() {
  ggbApplet.unregisterClickListener('LO');
  window.
  setTimeout("\
  ggbApplet.registerClickListener('L1');\
  c('L0');",500)
}
function L1() {
  ggbApplet.unregisterClickListener('L1');
  ggbApplet.registerClickListener('L2');
  c('L1');
}
function L2()
{
  ggbApplet.unregisterClickListener('L2');
  ggbApplet.registerClickListener('L3');
  c('L2');
}
function L3()
{
  ggbApplet.unregisterClickListener('L3');
  ggbApplet.registerClickListener('LO');
  c('L3');
}

L0();

photo
1

I suggest you use a proper editor like Notepad++ to edit the JavaScript


  ggbApplet.registerClickListener('LO');

should be

  ggbApplet.registerClickListener('L0');

photo
1

Thank you Michael and I'm sorry for troubling you with a typo.

Unfortunately

It's not that simple for the work, that may need 100 lines of code,

from which I extracted that .

Btw

I am quite satisfied with my kwrite comming with SuSE Linux Leap 42.3

offering syntax- and matching -parantheses... highlighting for a lot of languages.

And then, the "javascript environmentt" from firefox even more - but

of course cannot detect all typos.

photo
© 2019 International GeoGebra Institute