How to preserve special characters in dynamic textfield for text comparison?
The problem is as follows:
Since I mostly develop for multiple languages I am forced to have dynamic textfields in my buttons which contain three lines (to account for the differnt text.lengths in different languages).
I then populate the textfields with strings out of an array or xml and use the textfields contents later in my button class to execute different code depending on the textfields content.
This works fine as long as I don`t use any special characters, like for example "\n".
var labels:Array = ["\nLABEL1","LABEL\n\n2"];
...
switch (e.currentTarget.txt.text)
{
case labels[0]:
doSomething();
break;
case labels[1]:
doSomethingElse();
break;
}
...
shows the right thing in the button label (breaks the text were I want it)
but stops to work
(with htmlText & <br> its the same)
my workaround for the moment is to use filler spaces,
var labels:Array = [" LABEL1","LABEL 2"];
but that`s obviously ugly to setUp and requires a lot of trial/error to get it right for all languages.
Any ideas how to bypass that?