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. March 8th, 2017 at 17:12 | #1

    Most e read­ers also settle for books downloaded from different stores without con­verting their format.

  2. March 10th, 2017 at 00:21 | #2

    I’m also commenting to let you understand of the incredible
    discovery our child enjoyed using yuor web blog. She picked up lots of things,
    most notably how it is like to have an incredible coaching character to get men and women easily
    completely grasp selected impossible subject matter.
    You really surpassed my expected results. Thanks for churning
    out such insightful, safe, explanatory and in addition unique tips
    about the topic to Gloria.

  3. March 13th, 2017 at 04:07 | #3

    That is really fascinating, You’re a very skilled blogger.
    I’ve joined your feed and look ahead to looking for more of
    your excellent post. Also, I have shared your site
    in my social networks

  4. March 13th, 2017 at 04:44 | #4

    Excellent blog you’ve got here.. It’s difficult to find good quality writing like yours nowadays.
    I honestly appreciate individuals like you!
    Take care!!

  5. March 13th, 2017 at 05:39 | #5

    更年期の症状でお困りの方へ。
    エクオールが効果的ですよ。
    更年期の症状が表れるのは、女性ホルモンが突然減少することが、原因です。
    そこでエストロゲンと同様の機能をするエクオールを飲めばいいんです。
    けれども日本人の50%は、腸の中で大豆製品をエクオールに変化させることができません。
    そこで大豆製品ではなく、エクオールの成分をダイレクトに飲むしかありません。

  6. March 14th, 2017 at 14:15 | #6

    Sіnce the admin оf thbis site іs ᴡorking, no uncertainty vеr soion it wiⅼl be renowned,
    due tto itѕ feature ϲontents.

  7. March 16th, 2017 at 02:47 | #7

    You could certainly see your skills in the article you write.
    The sector hopes for more passionate writers like you who aren’t afraid to mention how they believe.
    Always go after your heart.

  8. March 18th, 2017 at 11:36 | #8

    Hi to all, the contents existing at this website are genuinely amazing for people experience,
    well, keep up the nice work fellows.

  9. March 19th, 2017 at 07:25 | #9

    Your style is unique in comparison to other folks I’ve read stuff from.
    I appreciate you for posting when you’ve got the
    opportunity, Guess I will just bookmark this site.

  10. March 23rd, 2017 at 08:43 | #10

    Pediatric dentistry offices in Chicago deal will oral injuries like fractures and missing teeth as well.

    The pediatric dentist recommends the very best course of action to follow for the moms and dads.

  11. March 25th, 2017 at 10:08 | #11

    Surprisingly, Conductors research study inform us that over 50% of the
    Ton of money 500 business have NO organic search exposure for their most important paid search terms.

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