Highlighted

Big number in a text caption

Contributor ,
Dec 06, 2018

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 :

GN_01.png

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 !...

...

Most Valuable Participant
Correct answer by Lilybiri | Most Valuable Participant

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.....

Views

156

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Big number in a text caption

Contributor ,
Dec 06, 2018

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 :

GN_01.png

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 !...

...

Most Valuable Participant
Correct answer by Lilybiri | Most Valuable Participant

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.....

Views

157

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 06, 2018 0
Most Valuable Participant ,
Dec 06, 2018

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.....

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 0
Contributor ,
Dec 06, 2018

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... )

...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 0
Contributor ,
Dec 06, 2018

Copy link to clipboard

Copied

...

Finally !...

GN_02.png

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 !!!...

...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 0
Most Valuable Participant ,
Dec 06, 2018

Copy link to clipboard

Copied

Je m'excuse, j'était en train de faire des Voice Overs

Félicitations!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 0
Dirlo LATEST
Contributor ,
Dec 06, 2018

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 !!...

...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 0