I found by experimentation that the following works, 

    public static const RESTRICT_STRING_FOR_CSV:String = "0-9 
a-zA-Z\&\"'~!@#$%*()\\-_+=[]|;:<>.?,\\^{}"; 

which uses ONE backslash to escape the ampersand and double-quote characters, 
but TWO backslashes to escape the minus sign (e.g. \\-) and the caret (e.g. 
\\^). However, I can't seem to figure how to escape the backslash character (I 
tried \\ and \\\ and neither worked). 

Is this making sense to anyone? Any idea how to escape backslash?

----- Original Message ----- 
From: [email protected] 
To: [email protected] 
Sent: Thursday, March 6, 2014 9:02:07 AM 
Subject: Re: how to mxml restrict with binding AS3 variable? 

Setting textInput.restrict=... in creation complete didn't change anything. 
There must be some difference or interaction between escape characters written 
in AS3 working in mxml. I need a programmatic solution, as there are so many 
places I can't manually write mxml code for each restrict. Any ideas? [Alex: 
not sure what you meant by "trace out the restrict property..." -- I'm testing 
by manually entering the characters in the text input field and seeing which 
ones work and which ones don't.] 

----- Original Message ----- 

From: "Alex Harui" <[email protected]> 
To: [email protected] 
Sent: Thursday, March 6, 2014 8:33:07 AM 
Subject: Re: how to mxml restrict with binding AS3 variable? 

Don't use binding, set it directly in creationComplete/applicationComplete 
and see if you still have a problem. If so, trace out the restrict 
property from the TextInput to see if got modified somehow. 

On 3/6/14 8:25 AM, "[email protected]" <[email protected]> wrote: 

>Spark TextInput, on web/desktop. 
> 
>----- Original Message ----- 
> 
>From: "Maurice Amsellem" <[email protected]> 
>To: [email protected] 
>Sent: Thursday, March 6, 2014 8:11:58 AM 
>Subject: RE: how to mxml restrict with binding AS3 variable? 
> 
>Are u using spark or mx TextInput ? is it on mobile or web/desktop? 
> 
>Maurice 
> 
>-----Message d'origine----- 
>De : [email protected] [mailto:[email protected]] 
>Envoyé : jeudi 6 mars 2014 16:42 
>À : apache flex users 
>Objet : how to mxml restrict with binding AS3 variable? 
> 
>Everytime I try to modify my restrict characters I run into problems, so 
>I don't think I'm understanding it well. My understanding was that I need 
>to use a \ character before another character to escape it in AS3. 
>However, since I'm using an AS3 variable in a bind expression for mxml, 
>perhaps this changes the way I need to escape characters. Here's my 
>current code: 
> 
> 
>My mxml code has: 
> 
> 
>restrict=" { AppController.RESTRICT_CHARS } " 
> 
> 
>and the AppController singleton has: 
> 
> 
>public static const RESTRICT_CHARS:String= "\&\"0-9 
>a-zA-Z'~!@#$%*()\\-_+=[]\\|;:<>./?{}^," ; 
> 
> 
>This code has a problem when I run it where I cannot enter a comma 
>character. Also, I found my trial an error that I needed two \\ to escape 
>the minus sign (not sure why... do I need two \\ when I escape other 
>characters?). Also, I found that I needed to place the \& at the start of 
>the string (if in the middle it has no effect). I must be doing something 
>wrong. Any help much appreciated. 
> 



Reply via email to