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. February 13th, 2018 at 15:41 | #1

    Thanks for finally talking about >Flex 4: Changing the “displayAsPassword”
    default character | eonflex.com <Liked it!

  2. February 14th, 2018 at 21:01 | #2

    You need to be a part of a contest for one of the most useful blogs on the net.

    I’m going to recommend this blog!

  3. February 16th, 2018 at 12:36 | #3

    Wohh just what I was looking for, appreciate it for putting up.

  4. February 17th, 2018 at 20:04 | #4

    At this time it looks like Expression Engine is the top blogging platform available right now.
    (from what I’ve read) Is that what you’re using on your blog?

  5. February 18th, 2018 at 01:13 | #5

    I’m pretty pleased to uncover this website.
    I want to to thank you for your time for this particularly fantastic read!!
    I definitely savored every bit of it and i also have you saved to
    fav to see new information in your blog.

  6. February 18th, 2018 at 10:21 | #6

    Your style is unique in comparison to other people I’ve read stuff from.

    Thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this site.

  7. February 18th, 2018 at 16:51 | #7

    My developer is trying to persuade me to move to .net
    from PHP. I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress
    on various websites for about a year and am concerned about switching to another platform.
    I have heard very good things about blogengine.net. Is there
    a way I can transfer all my wordpress content into it? Any help would be greatly appreciated!

  8. February 18th, 2018 at 18:49 | #8

    A smartphone also is likewise more useful thnan the Oculus, consisting of for things besides
    home entertainment. Additionally, peeople who buyy them normally already have cellular phone
    bills, so that part does nnot enhance the overall expenditure.

  9. February 26th, 2018 at 09:17 | #9

    First of all I want to say terrific blog! I had a quick question that I’d like to ask if you
    do not mind. I was interested to find out how you center yourself and clear your mind before writing.
    I have had a tough time clearing my mind in getting my
    ideas out there. I truly do take pleasure in writing however it just seems like the first
    10 to 15 minutes are generally lost just trying to figure out
    how to begin. Any suggestions or tips? Appreciate it!

  10. March 10th, 2018 at 00:59 | #10

    Great site you have here but I was curious about if
    you knew of any forums that cover the same topics discussed in this article?
    I’d really love to be a part of group where I can get responses from other knowledgeable individuals that share the same interest.
    If you have any recommendations, please let me
    know. Thanks!

  11. March 10th, 2018 at 08:27 | #11

    This idea was the developed and after prototypes were
    manufactured the theory was further resulted in a mobile phone oral appliance thus the i – Phone was
    born. i – Phone 5 specifications leaked: Design data is available before the formal release date – The specifications of the gadget are not released formally yet.iphone 8 plus cu mau den The
    company has postponed the production of the much awaited
    i – Phone 5, paving just how for the i – Phone 4 successor, the i – Phone 4S.

  12. March 11th, 2018 at 08:38 | #12

    Its not my first time to go to see this website, i am browsing
    this web page dailly and get good data from here daily.

  13. March 17th, 2018 at 14:42 | #13

    Hi, just wanted to tell you, I loced this article.
    It was funny. Keep on posting!

  14. March 18th, 2018 at 19:02 | #14

    It’s awesome for me to have a web page, which is valuable designed for
    my know-how. thanks admin

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