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 17th, 2021 at 16:04 | #1
  2. March 29th, 2021 at 16:12 | #2
  3. June 14th, 2021 at 20:38 | #4

    It’s an remarkable piece of writing designed
    for all the internet visitors; they will get advantage from it I
    am sure.

  4. June 20th, 2021 at 02:47 | #5
  5. June 23rd, 2021 at 03:01 | #6

    As mentioned, traditional bag vacuums often create really in pretty
    baad shape compared to what they tidy up, as there
    is more often than not a spill from the dirt and dust
    when changing or disposing of bags, creating the mess tat you had just cleaneed up.
    Bagged hoovers are usually used in places like hospitals and
    offices where they do not have time for it to continue the equipment.
    So as the Regina Housekeeper Plus was ideal for her, it
    had noot been really suitable for me.

  6. June 28th, 2021 at 06:43 | #7

    You don’t want to play 1 note for the entire song, but you don’t wanjt
    to jump around also speedy either.

  7. August 12th, 2021 at 17:25 | #8

    Having read this I believed it was extremely enlightening.

    I appreciate you finding the time and energy to put this informative article together.

    I once again find myself personally spending a significant amount of time both reading and commenting.
    But so what, it was still worthwhile!

  8. August 19th, 2021 at 05:57 | #9

    Nice answers in return of this matter with genuine arguments and explaining everything regarding that.

  9. August 24th, 2021 at 18:30 | #10

    Thanks a lot for being my own mentor on this subject matter.
    I actually enjoyed your article quite definitely and most of all preferred
    how you handled the areas I widely known as controversial.
    You’re always extremely kind to readers like me and assist me
    to in my life. Thank you.

  10. October 2nd, 2021 at 20:07 | #11

    Magnificent web site. Plenty of helpful information here.

    I am sending it to several friends ans additionally
    sharing in delicious. And obviously, thank you to your effort!

  11. December 19th, 2021 at 10:46 | #12

    I don’t know whether it’s just me or if perhaps everyone else experiencing problems with your blog.
    It appears as if some of the text on your posts are running off the screen. Can somebody else please provide feedback and let me know if
    this is happening to them too? This may be a problem with
    my browser because I’ve had this happen previously.
    Appreciate it

  12. June 25th, 2022 at 03:47 | #13

    Hi there, always i used to check website posts here early in the daylight,
    since i like to gain knowledge of more and more.

  13. May 4th, 2023 at 03:57 | #14

    Hi, all the time i used to check blog posts here early in the morning, for the reason that i like to learn more and more.

    リアルドール
    ラブドール

  14. June 27th, 2023 at 07:59 | #15

    I don’t even know how I finished up right here, but I believed this put up was great.

    I do not recognise who you might be however certainly you are going
    to a famous blogger in the event you aren’t already. Cheers!

  15. August 26th, 2023 at 06:46 | #16

    Actually no matter if someone doesn’t know then its up
    to other viewers that they will assist, so here it occurs.

  16. September 21st, 2023 at 21:46 | #17

    Your ability to enhance complicated subject matters right into digestible content is admirable.
    This article, especially, stands as a testament to your devotion to encouraging
    expertise. It’s very clear that you strive to create a meaningful impact.

  17. September 21st, 2023 at 21:51 | #18

    Creating triggers curiosity, encouraging
    wish for know-how. Dedication to educating and also sharing wisdom is genuinely inspiring.

  18. September 26th, 2023 at 08:19 | #19

    That is ɑ ery good tip especially to those new too thhe
    blogοѕphere. Brief bᥙt very precise info… Appreciɑte your sharing this one.
    A mut read aгticle!

  19. October 22nd, 2023 at 11:13 | #20

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

  20. December 12th, 2023 at 21:39 | #21

    Hi there friends, its wonderful paragraph
    about cultureand completely defined, keep it up all
    the time.

  21. December 27th, 2023 at 23:40 | #22

    I do not know whether it’s just me or if everybody else encountering issues with your website.
    It seems like some of the written text on your content are running off the screen. Can someone else please provide feedback
    and let me know if this is happening to them
    as well? This could be a issue with my web browser because I’ve had this happen before.

    Cheers

  22. January 14th, 2024 at 20:37 | #23

    Nicely put, Kudos.

  23. January 19th, 2024 at 04:23 | #24

    Thanks a lot, Numerous stuff.

    my webpage – http://ldm.sakura.ne.jp/balu+bbbs/album/album.cgi?mode=detail&no=128

Comment pages
1 15 16 17 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
  5. January 25th, 2020 at 13:25 | #5
  6. March 28th, 2020 at 20:22 | #6
  7. March 30th, 2020 at 22:25 | #7
  8. July 2nd, 2020 at 04:14 | #8
  9. November 26th, 2023 at 17:35 | #9