Copy link to clipboard
Copied
...
Hello Captivaters !...
I'm starting to work with big numbers... I made a D&D slide in which I can put 1 000, 100, 10 or 1 blocks in a specific area.
And I have a variable which counts the number of cubes.
(Inspired by Paul Wilson's video : Drag and Drop Counting Game for Adobe Captivate 2019 - YouTube )
You can see this here :
Everything seems to work fine but my problem is :
=> I want my number to be 3 110 (with a space after the 3 first digit) instead of 3110.
As I will want to work with millions, billions... this will be more and more difficult to read for my learners without the spaces...
So I need you help !!...
Many thanks in advance !...
...
Il vous faudra du JavaScript.
There is a function 'toLocaleString()' which you could use, but not sure it is supported by all browsers. Moreover it will take over the way numbers are displayed in your country. That is not always with a space, here we are using a point, in USA they are using a comma.....
Copy link to clipboard
Copied
Il vous faudra du JavaScript.
There is a function 'toLocaleString()' which you could use, but not sure it is supported by all browsers. Moreover it will take over the way numbers are displayed in your country. That is not always with a space, here we are using a point, in USA they are using a comma.....
Copy link to clipboard
Copied
...
Thanks Lily !
But I don't know how to use this 'toLocaleString()'...
As my variable is called v_Total_01
I try (in a javascript window) this code :
var nombre = v_Total_01;
console.log(nombre.toLocaleString());
(I tried also with ""... with a c after the name...)
but without any success so far...
(As usual in fact everytime I tried to use javascript in captivate... )
...
Copy link to clipboard
Copied
...
Finally !...
Javascript code :
var nombre = v_Total_01.toLocaleString("fr-FR");
And I show nombre in the Text Caption, instead of the variable v_Total_01...
It was so simple that I spent my all afternoon on this !!!...
...
Copy link to clipboard
Copied
Je m'excuse, j'était en train de faire des Voice Overs
Félicitations!
Copy link to clipboard
Copied
...
Je n'accepte pas tes excuses !!... Car tu n'as nul besoin de t'excuser !...
Par contre je prends tes félicitations !...
Et je te remercie encore de m'avoir mis sur la piste du "toLocaleString" sans quoi je serais encore à bidouiller !!...
Merci encore (et encore) donc !!...
...