You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mo...@comcast.net on 2014/03/06 16:41:32 UTC

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.

RE: how to mxml restrict with binding AS3 variable?

Posted by Maurice Amsellem <ma...@systar.com>.
Regarding your original question of why you need \\ for escaping "-" or "^", this is because they are special characters, that must be escaped with "\".
Now, it seems that the compiler will also interpret "\" in static string as escape chars, except for \n, \t , \r ...
So that might be the reason.

If you can debug,  try different variations and trace(RESTRICT_STRING_FOR_CSV) to see what is the exact value.

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : jeudi 6 mars 2014 18:47
À : users@flex.apache.org
Objet : RE: how to mxml restrict with binding AS3 variable?

The restrict test happens in mx.util.StringUtil. testCharacter() The restrict sequence is parsed for each typed char.

I am currently looking at the code.
You might also have a look at it, if you have something ..

Maurice 

-----Message d'origine-----
De : modjklist@comcast.net [mailto:modjklist@comcast.net] Envoyé : jeudi 6 mars 2014 18:11 À : users@flex.apache.org Objet : Re: how to mxml restrict with binding AS3 variable?

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: modjklist@comcast.net
To: users@flex.apache.org
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" <ah...@adobe.com>
To: users@flex.apache.org
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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 

>Spark TextInput, on web/desktop. 
> 
>----- Original Message -----
> 
>From: "Maurice Amsellem" <ma...@systar.com>
>To: users@flex.apache.org
>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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 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.
> 




RE: how to mxml restrict with binding AS3 variable?

Posted by Maurice Amsellem <ma...@systar.com>.
The restrict test happens in mx.util.StringUtil. testCharacter()
The restrict sequence is parsed for each typed char.

I am currently looking at the code.
You might also have a look at it, if you have something ..

Maurice 

-----Message d'origine-----
De : modjklist@comcast.net [mailto:modjklist@comcast.net] 
Envoyé : jeudi 6 mars 2014 18:11
À : users@flex.apache.org
Objet : Re: how to mxml restrict with binding AS3 variable?

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: modjklist@comcast.net
To: users@flex.apache.org
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" <ah...@adobe.com>
To: users@flex.apache.org
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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 

>Spark TextInput, on web/desktop. 
> 
>----- Original Message -----
> 
>From: "Maurice Amsellem" <ma...@systar.com>
>To: users@flex.apache.org
>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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 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.
> 




Re: how to mxml restrict with binding AS3 variable?

Posted by mo...@comcast.net.
Thanks, that link shows how to restrict unicode characters. That's pretty useful too. 

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

From: "Joseph Balderson" <ne...@joeflash.ca> 
To: users@flex.apache.org 
Sent: Thursday, March 6, 2014 9:42:04 PM 
Subject: Re: how to mxml restrict with binding AS3 variable? 

If anyone's interested, the ref link in Om's blog entry is out of date. You can 
find it at: 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#restrict 

_______________________________________________________________________ 

Joseph Balderson, Flex & Flash Platform Developer :: http://joeflash.ca 
Author, Professional Flex 3 :: http://tinyurl.com/proflex3book 

OmPrakash Muppirala wrote: 
> On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote: 
>> 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? 
>> 
> 
> I blogged about this a while ago: 
> http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1 
> 
> See if that helps? 
> 
> Thanks, 
> Om 
> 
>> ----- Original Message ----- 
>> From: modjklist@comcast.net 
>> To: users@flex.apache.org 
>> 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" <ah...@adobe.com> 
>> To: users@flex.apache.org 
>> 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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 
>> 
>>> Spark TextInput, on web/desktop. 
>>> 
>>> ----- Original Message ----- 
>>> 
>>> From: "Maurice Amsellem" <ma...@systar.com> 
>>> To: users@flex.apache.org 
>>> 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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 
>>> 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. 
>>> 
>> 
>> 
> 


Re: how to mxml restrict with binding AS3 variable?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Hey, thanks for catching that!  I just updated my blog post with the
correct URL.

Om


On Thu, Mar 6, 2014 at 9:42 PM, Joseph Balderson <ne...@joeflash.ca> wrote:

> If anyone's interested, the ref link in Om's blog entry is out of date.
> You can
> find it at:
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#restrict
>
> _______________________________________________________________________
>
> Joseph Balderson, Flex & Flash Platform Developer :: http://joeflash.ca
> Author, Professional Flex 3 :: http://tinyurl.com/proflex3book
>
> OmPrakash Muppirala wrote:
> > On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote:
> >> 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?
> >>
> >
> > I blogged about this a while ago:
> >
> http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1
> >
> > See if that helps?
> >
> > Thanks,
> > Om
> >
> >> ----- Original Message -----
> >> From: modjklist@comcast.net
> >> To: users@flex.apache.org
> >> 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" <ah...@adobe.com>
> >> To: users@flex.apache.org
> >> 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, "modjklist@comcast.net" <mo...@comcast.net>
> wrote:
> >>
> >>> Spark TextInput, on web/desktop.
> >>>
> >>> ----- Original Message -----
> >>>
> >>> From: "Maurice Amsellem" <ma...@systar.com>
> >>> To: users@flex.apache.org
> >>> 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 : modjklist@comcast.net [mailto:modjklist@comcast.net]
> >>> 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.
> >>>
> >>
> >>
> >
>

Re: how to mxml restrict with binding AS3 variable?

Posted by Joseph Balderson <ne...@joeflash.ca>.
If anyone's interested, the ref link in Om's blog entry is out of date. You can
find it at:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#restrict

_______________________________________________________________________

Joseph Balderson, Flex & Flash Platform Developer :: http://joeflash.ca
Author, Professional Flex 3 :: http://tinyurl.com/proflex3book

OmPrakash Muppirala wrote:
> On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote:
>> 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?
>>
> 
> I blogged about this a while ago:
> http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1
> 
> See if that helps?
> 
> Thanks,
> Om
> 
>> ----- Original Message -----
>> From: modjklist@comcast.net
>> To: users@flex.apache.org
>> 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" <ah...@adobe.com>
>> To: users@flex.apache.org
>> 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, "modjklist@comcast.net" <mo...@comcast.net> wrote:
>>
>>> Spark TextInput, on web/desktop.
>>>
>>> ----- Original Message -----
>>>
>>> From: "Maurice Amsellem" <ma...@systar.com>
>>> To: users@flex.apache.org
>>> 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 : modjklist@comcast.net [mailto:modjklist@comcast.net]
>>> 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.
>>>
>>
>>
> 

Re: how to mxml restrict with binding AS3 variable?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Thu, Mar 6, 2014 at 12:33 PM, <mo...@comcast.net> wrote:

> Thanks Om, your blog explained it all. Hadn't seen it before, and thanks
> for writing it.
>
>
I am glad I noted that nugget down.  I don't remember how or when I ran
into that issue.  Anyways, glad that it helped you :-)

Thanks,
Om



> ----- Original Message -----
>
> From: "OmPrakash Muppirala" <bi...@gmail.com>
> To: users@flex.apache.org
> Sent: Thursday, March 6, 2014 10:05:15 AM
> Subject: Re: how to mxml restrict with binding AS3 variable?
>
> On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote:
> >
> > 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?
> >
>
> I blogged about this a while ago:
>
> http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1
>
> See if that helps?
>
> Thanks,
> Om
>
> > ----- Original Message -----
> > From: modjklist@comcast.net
> > To: users@flex.apache.org
> > 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" <ah...@adobe.com>
> > To: users@flex.apache.org
> > 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, "modjklist@comcast.net" <mo...@comcast.net>
> wrote:
> >
> > >Spark TextInput, on web/desktop.
> > >
> > >----- Original Message -----
> > >
> > >From: "Maurice Amsellem" <ma...@systar.com>
> > >To: users@flex.apache.org
> > >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 : modjklist@comcast.net [mailto:modjklist@comcast.net]
> > >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.
> > >
> >
> >
> >
>
>

Re: how to mxml restrict with binding AS3 variable?

Posted by mo...@comcast.net.
Thanks Om, your blog explained it all. Hadn't seen it before, and thanks for writing it. 

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

From: "OmPrakash Muppirala" <bi...@gmail.com> 
To: users@flex.apache.org 
Sent: Thursday, March 6, 2014 10:05:15 AM 
Subject: Re: how to mxml restrict with binding AS3 variable? 

On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote: 
> 
> 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? 
> 

I blogged about this a while ago: 
http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1 

See if that helps? 

Thanks, 
Om 

> ----- Original Message ----- 
> From: modjklist@comcast.net 
> To: users@flex.apache.org 
> 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" <ah...@adobe.com> 
> To: users@flex.apache.org 
> 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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 
> 
> >Spark TextInput, on web/desktop. 
> > 
> >----- Original Message ----- 
> > 
> >From: "Maurice Amsellem" <ma...@systar.com> 
> >To: users@flex.apache.org 
> >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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 
> >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. 
> > 
> 
> 
> 


Re: how to mxml restrict with binding AS3 variable?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Mar 6, 2014 9:11 AM, <mo...@comcast.net> wrote:
>
> 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?
>

I blogged about this a while ago:
http://www.bigosmallm.com/2008/03/how-to-restrict-backslash-character.html?m=1

See if that helps?

Thanks,
Om

> ----- Original Message -----
> From: modjklist@comcast.net
> To: users@flex.apache.org
> 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" <ah...@adobe.com>
> To: users@flex.apache.org
> 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, "modjklist@comcast.net" <mo...@comcast.net> wrote:
>
> >Spark TextInput, on web/desktop.
> >
> >----- Original Message -----
> >
> >From: "Maurice Amsellem" <ma...@systar.com>
> >To: users@flex.apache.org
> >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 : modjklist@comcast.net [mailto:modjklist@comcast.net]
> >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.
> >
>
>
>

RE: how to mxml restrict with binding AS3 variable?

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
I remember certain regex patterns it makes a difference if you move certain characters to the end of the list.

-Mark

-----Original Message-----
From: modjklist@comcast.net [mailto:modjklist@comcast.net] 
Sent: Thursday, March 06, 2014 12:11 PM
To: users@flex.apache.org
Subject: Re: how to mxml restrict with binding AS3 variable?

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?

Re: how to mxml restrict with binding AS3 variable?

Posted by mo...@comcast.net.
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: modjklist@comcast.net 
To: users@flex.apache.org 
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" <ah...@adobe.com> 
To: users@flex.apache.org 
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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 

>Spark TextInput, on web/desktop. 
> 
>----- Original Message ----- 
> 
>From: "Maurice Amsellem" <ma...@systar.com> 
>To: users@flex.apache.org 
>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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 
>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. 
> 




Re: how to mxml restrict with binding AS3 variable?

Posted by mo...@comcast.net.
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" <ah...@adobe.com> 
To: users@flex.apache.org 
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, "modjklist@comcast.net" <mo...@comcast.net> wrote: 

>Spark TextInput, on web/desktop. 
> 
>----- Original Message ----- 
> 
>From: "Maurice Amsellem" <ma...@systar.com> 
>To: users@flex.apache.org 
>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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 
>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. 
> 



Re: how to mxml restrict with binding AS3 variable?

Posted by Alex Harui <ah...@adobe.com>.
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, "modjklist@comcast.net" <mo...@comcast.net> wrote:

>Spark TextInput, on web/desktop.
>
>----- Original Message -----
>
>From: "Maurice Amsellem" <ma...@systar.com>
>To: users@flex.apache.org
>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 : modjklist@comcast.net [mailto:modjklist@comcast.net]
>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.
>


Re: how to mxml restrict with binding AS3 variable?

Posted by mo...@comcast.net.
Spark TextInput, on web/desktop. 

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

From: "Maurice Amsellem" <ma...@systar.com> 
To: users@flex.apache.org 
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 : modjklist@comcast.net [mailto:modjklist@comcast.net] 
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. 


RE: how to mxml restrict with binding AS3 variable?

Posted by Maurice Amsellem <ma...@systar.com>.
Are u using spark or mx TextInput ?  is it on mobile or web/desktop?

Maurice 

-----Message d'origine-----
De : modjklist@comcast.net [mailto:modjklist@comcast.net] 
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.