JavaScript (Variables and Beyond)

Oct 01, 2020

Hi all, hope you are having a great day!

I am new to articulate but have a strong background in JavaScript and prefer to use it to simplify the chaos of a long list of triggers.

I would really appreciate it if someone could point me in the right direction regarding the following 2 points (I dont have a specific goal in mind, i just want to know how to achieve these)

1. I have a numeric entry and a reset button with the following javascript attached to the button click trigger.

var my_zero = 0; // a null variable
player = GetPlayer(''); // establish connection between sl and js
player.SetVar('num_input',my_zero); // tell sl to change the value of sl variable linked to numeric entry to zero

While this does what is advertised, when i double click on the numeric entry again, it recalls the last entered value and again switches from zero to the previously entered value -and i cant figure out why.

 

2. I understand connection between sl and js, getting vars and setting vars. Can we go beyond this and use javascript to change for example the size or position of a shape or even color?

I really appreciate your time fellas!

 

1 Reply
Math Notermans

Yes you can change almost anything on the Storyline stage. Biggest issue is getting to the correct element. Jquery selectors work well, but keep in mind that most default elements in Storyline is inline SVG, and alas SVG doesnot work well with JQuery ;-)

I use the acc-text to select any element and animate it in Storyline.

Even managed to Morph basic SVG elements in Storyline... not ready...Work in Progress...but
you can see that with JS i managed to manipulate pure Storyline shape-elements and states of them... as said...not complete...but to give you some ideas of whats possible if you dig deep enough...

https://360.articulate.com/review/content/7509c00d-c7f4-410f-8a13-7aae49903563/review

Regards,
Math

This discussion is closed. You can start a new discussion or contact Articulate Support.