Number gets truncaded when sendingText I/O a decimal number string

Problem description:

I am sending a string to a Text I/O "text" animation. The string contains a decimal number (for example, 123.456) and when the Text I/O displays the string, it is truncated to just an integer number (in the example, 123).

 

Solution:

This can happen if there is more than one Text I/O object with the same names for their "text" and "integer" and "float" animations. For example, two Text I/Os have the same "text" animation named "volume_text" and the same "integer" animation named "volume_integer" and the same "float" animation named "volume_float".

When a string arrives on the Text I/O "text" animation, the Text I/O object has logic to check if the string represents a number. If it does, the Text I/O generates two events with the number value. First it generates an event for its "float" animation (for the example, this would be 123.456 for "volume_float") and then an event for its "integer" animation (for the example, this would be 123 for "volume_integer"). This behavior makes sure that the "float" and "integer" animations stay synchronized with the number string being displayed by the Text I/O if it is displaying a number.

When an instance of the Text I/O generates the "float" and "integer" events, it is smart enough to know that it should not listen to the events (because it generated them).

If, however, a second instance of a Text I/O is processing the same string and sending events for the same animations, these events get processed by the first instance of the Text I/O and the events from the first instance get processed by the second instance. In our example, the result is both Text I/Os show 123 because the "integer" animation changes after the "float" animation.

The fix is to rename the "float" and "integer" animations for at least one of the Text I/Os so they are unique. If there are more than two Text I/Os with the same "float" and "integer" animations, also rename the animations for these additional Text I/Os.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.