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)

     *  @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:

import mx.core.mx_internal;
 * Constructor
public function myTextInput()
	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. September 22nd, 2018 at 19:48 | #1

    I know this site offers quality dependent
    posts and extra information, is there any other website which offers these information in quality?

  2. September 25th, 2018 at 10:37 | #2

    After I originally commented I appear to have clicked the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive four emails with
    the exact same comment. There has to be an easy method you can remove
    me from that service? Appreciate it!

  3. September 26th, 2018 at 07:02 | #3

    Helpful info. Lucky me I discovered your site by accident, and I’m surprised why this coincidence didn’t happened
    in advance! I bookmarked it.

  4. September 27th, 2018 at 11:06 | #4

    Howdy excellent blog! Does running a blog like this require a large amount of work?
    I have no understanding of programming however I had
    been hoping to start my own blog in the near future. Anyways, should you have any suggestions or techniques for new blog owners please share.
    I understand this is off subject but I just needed to ask.
    Thanks a lot!

  5. September 27th, 2018 at 11:23 | #5

    Wow, amazing weblog layout! How long have you been running a blog for?
    you made running a blog glance easy. The entire look of your website is great, as smartly
    as the content material!

  6. September 30th, 2018 at 02:39 | #6

    You actually make it appear so easy with your presentation however I to find this topic to be actually
    something which I feel I would by no means understand.
    It sort of feels too complicated and extremely vast for me.
    I am taking a look forward to your subsequent put up, I’ll attempt to get the hold of it!

  7. September 30th, 2018 at 20:50 | #7

    The problem however is always that sending paper birthday
    cards through send to friends and household who’re far could possibly be quite expensive and usually delayed.

    Feel free to start doing a web based search anytime the necessity for a
    no cost birthday greetings card arises.
    Share funny stories about the person that highlights what makes them
    special and well-loved.

  8. October 1st, 2018 at 04:36 | #8

    I was reading through some of your content on this internet site and I believe
    this web site is very instructive! Keep putting up.

  9. October 1st, 2018 at 10:49 | #9

    Hey nice post! I hope it’s ok that I shared it on my FB, if not, no worries just let me know and I’ll remove it.
    Regardless keep up the good work.

  10. October 3rd, 2018 at 16:10 | #10

    That is a really good tip particularly to those fresh
    to the blogosphere. Simple but very precise information… Thank you for sharing this one.
    A must read article!

  11. October 6th, 2018 at 15:36 | #11

    I’m gone to say to my little brother, that he should also pay a
    quick visit this blog on regular basis to get updated from latest news.

  12. October 12th, 2018 at 06:30 | #12

    That is really fascinating, You are an excessively professional blogger.
    I have joined your rss feed and sit up for searching for mkre of
    your magnificent post. Additionally, I have shared your site in my
    social networks

  13. October 13th, 2018 at 18:52 | #13

    I invite Larry, the sweetheart, to share the encounter from indulging in every
    great tasting scrap from my Red Plush Birthday cake.

Comment pages
1 12 13 14 435
  1. March 19th, 2014 at 11:13 | #1
  2. April 30th, 2014 at 01:00 | #2