Moving with Variables

On the forum i noticed a thread about moving a button on a click with variables. Although this got a solution quite quickly, i wanted to make a solution of my own. To ensure reusability i used a javascript that gets the position of the cross-markers in Lectora and sends these back to Lectora to be used as variables. To show its flexibility and reusability i added 2 buttons to make the position of the cross-markers random and/or to make the button jump to one of them randomly.

Preview image



  1. Profile photo of Nick Williams
    Nick Williams

    Hi Math, awesome example.
    I’ve often seen the Move to variable option in Lectora, but have never used it as I’ve not known how to best utilise it.

    Could you give an example of when you would use this feature in your demonstration?

  2. Profile photo of Math Notermans
    Math Notermans Post author

    Hi Nick,
    Any animation that needs to be dynamic. For example a gamecharacter that needs to react to a users input. Or a dial on a gauge that reacts to a choice of a user. I made courses for the automotive industry in which gauges needed to show the value a user picked for an exercise.
    And i can think of many many more..

  3. Profile photo of Holly Heston
    Holly Heston

    Hi Math – Maybe you could help me. I want to use the Move action based on x and y variables. For instance, Move to: (current x position + 25), (current Y position +45). So that the action reads the object’s current x and y and moves appropriately. Is this what you did with the java script – getting the object’s x and y to read as variables? If so, could you tell me how you did it? Thanks.

  4. Profile photo of Math Notermans
    Math Notermans Post author

    Hi Holly,

    I have shared another example that uses MoveTo in combination with variables.
    I this one i do think the x / y position are captured without the use of complex javascript.

    With the use of both Lectora files you should be able to reuse the code needed for getting the x/y positions. If you dont succeed let me know and i will clean up and mockup a simple variant to explain.
    Im not sure whether this is a L17 compatible version or old plain L16 without ‘seamless’.
    Let me know if you have more questions.


Your email address will not be published. Required fields are marked *