Javascript issues

Andrius shared this question 6 months ago
Needs Answer

Hello Geogebra, 

I have tried using the Javascript option, however, I am still a beginner, and it would be nice if you could help me. I am trying to make a point(M_1) move when a button(Left) is pressed. Can you please explain why it doesn´t work. P.S. I have succeeded doing it using ordinary Geogebra scripting, but it would be nice to learn the Java way as well. I am very sorry if this isn't the place for such questions.

function ggbOnInit() {}

var posx =
var posy =

function OnClick() {
    var posx = getXcoord("M_1")
    var posy = getXcoord("M_1")

    setCoords("M_1", posx + 1, posy + 1)
}

registerObjectClickListener("Left", "OnClick")

© 2020 International GeoGebra Institute