

Javascript command charAt() in Cp with flexible length of string
Hi all,
I am a newbie on Javascript. Got inspired by Greg Stager during last week’s Adobe EL World 2021. And now I want more 🙂 !!
In my project I control an object via Javascript: I can rotate that object while pressing buttons. It’s like a compass pin: per click it rotates 9 degrees. No problem.
What I want is that these degrees are shown in Cp. Neither a problem since I declared a Cp-variable that contains the value of the rotation in degrees after each button press.
But now I want to know the contents of that Cp-variable string on “character level”. That string can contain 1 character (like 9 degrees), two (like 45 degrees) or at a max 3 characters (like 351 degrees). Stated differently: I want to know if the string contains 3, 2 or 1 characters + what is the contents of the 1st, 2nd and 3rd character.
I tried to do that with the Javascript command charAt(). But there’s no output in Cp, nor an error message. I tested my solution in a free Javascript editor website: no error.
Objective:
I want the degrees being projected as digital numbers (0-9), which are separate pictures of digits. For each position (max 3) I planned to use an object with 10 states (10 small pictures of digits from 0 to 9). So in total 3 objects of the samen kind. When I know what number is on each spot in the string, then I can change the object state to that specific number.
I assume the “non responding Javascript” in Cp has something to do with the fact that the Cp-Variable string length is not constant: it grows from 1 character -> 2 characters -> 3 characters max. But my Js knowledge and definitely my Js skills are poor…
Who wants to help me??
Hi all,
I am a newbie on Javascript. Got inspired by Greg Stager during last week’s Adobe EL World 2021. And now I want more 🙂 !!
In my project I control an object via Javascript: I can rotate that object while pressing buttons. It’s like a compass pin: per click it rotates 9 degrees. No problem.
What I want is that these degrees are shown in Cp. Neither a problem since I declared a Cp-variable that contains the value of the rotation in degrees after each button press.
But now I want to know the contents of that Cp-variable string on “character level”. That string can contain 1 character (like 9 degrees), two (like 45 degrees) or at a max 3 characters (like 351 degrees). Stated differently: I want to know if the string contains 3, 2 or 1 characters + what is the contents of the 1st, 2nd and 3rd character.
I tried to do that with the Javascript command charAt(). But there’s no output in Cp, nor an error message. I tested my solution in a free Javascript editor website: no error.
Objective:
I want the degrees being projected as digital numbers (0-9), which are separate pictures of digits. For each position (max 3) I planned to use an object with 10 states (10 small pictures of digits from 0 to 9). So in total 3 objects of the samen kind. When I know what number is on each spot in the string, then I can change the object state to that specific number.
I assume the “non responding Javascript” in Cp has something to do with the fact that the Cp-Variable string length is not constant: it grows from 1 character -> 2 characters -> 3 characters max. But my Js knowledge and definitely my Js skills are poor…
Who wants to help me??
You must be logged in to post a comment.

- Most Recent
- Most Relevant