2 Replies Latest reply on Feb 14, 2016 1:16 PM by caiblack

    toLocaleString

    caiblack

      Hi,

       

      I'm trying to create an animated text effect that outputs using the JavaScript "toLocaleString" method of the built-in String class.

       

      I want to format a numerical value (it's actually a Number in the JavaScript sense) as currency with the currency symbol, commas, and decimal point, but when I use the following command, I only get the raw value:

       

      [slider value]

      123456.78


      [code]

      A = effect("Slider Control")("Slider").value.toLocaleString( "en-US", { style: "currency", currency: "USD" });

       

      [output]

      123456.78

       

      [expected]

      $123,456.78

       

       

      Additionally, values greater than 1000000.00 appear to not be supported in the Slider effect. Is this a known and documented issue/feature?

       

      If there's an alternate way to achieve this effect, then, please, let me know ASAP.

       

      Thanks.

        • 1. Re: toLocaleString
          Rick Gerard Adobe Community Professional & MVP

          Are you talking expressions in After Effects to create a video or are you talking about Web design or some other kind of scripting? Sliders do have a finite value but you can add a multiplier.

           

          If you're talking expressions then take a look at Dan Ebberts Universal counter. universal counter - Dan Ebberts's Expressioneering Design ...

           

          I have a highly modified version of that as an aviation preset that I use all the time.

          • 2. Re: toLocaleString
            caiblack Level 1

            Hi, Rick.

             

            Yes, in After Effects.

             

            I'll take a look at the Expressioneering link that you suggested. I have an alternate idea that may do what I need, since the "toLocaleString" method doesn't appear to work as-expected.

             

            Thanks for the swift response.

             

            [edited]

            It looks like that the "universal counter" link will do what I need it to do. It's only "universal" in the sense that the developer can replace (manually) the currency symbol, comma usage, and decimal places.

             

            A better resolution would be for Adobe to support the internationalization features available in JavaScript.