Home > Adobe Flex > Flex 4: Changing the “displayAsPassword” default character

Flex 4: Changing the “displayAsPassword” default character

Today I ran into a situation where I wanted to display my password characters as a bullet versus the default asterisk (“*”).

I thought this would be pretty simple to do but realized after digging through the Flex 4 SDK that there was no public property I could set to change this. I tried hacking commitProperties and a couple of other methods but came up short in those areas as well until I found the exact spot in the Flex libraries where this character was defined:

RichEditableText.as (line 679)

1
2
3
4
    /**
     *  @private
     */
    mx_internal var passwordChar:String = "*";

A-ha! I see here that it’s prefixed with the “mx_internal” namespace and I remembered from other examples around the web that you can easily tap into that namespace and modify properties not normally meant to be modified.

Luckily, I had already extended the TextInput class for various other reasons and decided to add an event listener for the CREATION_COMPLETE lifecycle event of the component. This was added in the constructor:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import mx.core.mx_internal;
 
/**
 * Constructor
 */
public function myTextInput()
{
	super();
 
	this.addEventListener( FlexEvent.CREATION_COMPLETE, onCreationComplete );
}
 
private function onCreationComplete( event : FlexEvent ) : void
{
	//change internal passwordChar to a bullet versus an asterisk
	this.textDisplay.mx_internal::passwordChar = "●";
}

…and voila! By tapping into the mx_internal namespace, I found I could modify the normally private variable “passwordChar” and set it to something I preferred better (in this case, the bullet point used in some sites like Twitter).

Hope this helps someone!

Categories: Adobe Flex Tags:
  1. February 4th, 2019 at 04:45 | #1

    For most up-to-date news you have to pay a visit the web and on world-wide-web I found this website as a finest web site
    for hottest updates.

  2. February 23rd, 2019 at 19:52 | #2

    You are so cool! I don’t thinnk I’ve read someyhing like this before.
    So grfeat to discover another person with unique thoughts on tis topic.
    Seriously.. thank you for starting this up. This site is one thinng that’s needed on the web, someone
    with a bit of originality!

  3. February 24th, 2019 at 16:06 | #3

    My family all the time say that I am killing my time here at net, but I know I
    am getting knowledge all the time by reading thes pleasant
    articles or reviews.

  4. March 12th, 2019 at 19:41 | #4

    Thanks to my father who informed me on the topic of this
    weblog, this blog is actually awesome.

  5. March 14th, 2019 at 08:08 | #5

    Fastidious replies in return of this query with solid arguments and describing all
    concerning that.

  6. March 18th, 2019 at 11:48 | #6

    Hmm is anyone else encountering problems with the images
    on this blog loading? I’m trying to figure
    out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.

  7. April 1st, 2019 at 01:15 | #7

    For hottest news you have to pay a visit world wide web and
    on the web I found this web site as a most excellent web site for newest updates.

  8. April 1st, 2019 at 15:13 | #8

    It’s important to remember your financial allowance and fashionableness
    to quell the impulse shopping, and after that you’re suire to find some steals.
    Sonia is someone that spent her entire life around the creative world,
    in the age of 17 she worked with a textile shop helppful to decorate the window dsplays to improve attract customers.
    Unfortunately, most top end one button suits can run with a cost off several thousand dollars.

  9. April 2nd, 2019 at 02:57 | #9

    El Tongkat Ali es una de las hierbas más poderosas para alabar los niveles de testosterona.
    TONGKAT ALI ROOT: es el recibo de la piel y la vivero de un eje de acero
    perdurable, que aumenta la libido y tiene un zona de influencia anti-inflamatorio.

  10. April 11th, 2019 at 06:10 | #10

    Great goods from you, man. I’ve keep in mind your stuff prior to and
    you’re simply too magnificent. I really like what you have acquired right
    here, certainly like what you’re stating
    and the way by which you assert it. You are making it enjoyable
    and you still care for to keep it wise. I can’t wait to read far more from
    you. This is actually a wonderful website.

  11. April 12th, 2019 at 05:54 | #11

    My brother suggested I may like this web site.
    He was entirely right. This put up truly made my day.

    You cann’t imagine simply how so much time I had spent for this info!

    Thanks!

Comment pages
1 13 14 15 435
  1. March 19th, 2014 at 11:13 | #1
  2. April 30th, 2014 at 01:00 | #2
  3. December 31st, 2018 at 08:24 | #3
  4. February 2nd, 2019 at 20:25 | #4