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. January 12th, 2025 at 22:05 | #1

    Having read this I believed it was really informative.
    I appreciate you finding the time and energy to put
    this article together. I once again find myself spending a significant amount of time both reading and commenting.
    But so what, it was still worthwhile!

  2. January 12th, 2025 at 22:06 | #2

    I every time spent my half an hour to read this website’s posts every day along with a cup of
    coffee.

  3. January 12th, 2025 at 22:20 | #3

    Stress Relief For Women – 3 Super Guidelines For
    Putting Yourself First 부산

  4. January 12th, 2025 at 22:22 | #4

    Terrific post but I was wanting to know if you
    could write a litte more on this topic? I’d be very thankful if you could elaborate a
    little bit further. Thank you!

  5. January 12th, 2025 at 22:37 | #5

    Spa Therapy OP (gaea.Ais.ne.jp)

  6. January 12th, 2025 at 22:39 | #6

    Only Topic . Unique Bridal Shower Games OP

  7. January 12th, 2025 at 22:45 | #7

    I could not refrain from commenting. Perfectly written!

  8. January 12th, 2025 at 22:47 | #8

    I believe what you wrote made a great deal of sense. However, consider this, what if you
    were to create a awesome title? I mean, I don’t want to
    tell you how to run your blog, but suppose you added something that grabbed folk’s attention? I mean Flex 4: Changing
    the “displayAsPassword” default character | eonflex.com is a little plain. You should look
    at Yahoo’s home page and watch how they create post headlines to grab people interested.
    You might try adding a video or a picture or two to grab
    people excited about what you’ve written. Just my opinion, it could make your posts a little livelier.

  9. January 12th, 2025 at 22:47 | #9

    Excellent blog here! Also your web site loads up
    very fast! What web host are you using? Can I get your affiliate
    link to your host? I wish my website loaded up as fast as yours lol

  10. January 12th, 2025 at 22:55 | #10

    Kudos. Terrific stuff.

  11. January 12th, 2025 at 22:57 | #11

    Amazing information, Kudos!

  12. January 12th, 2025 at 23:08 | #12

    How The Following A Roulette System To Win At Roulette 에볼루션 주식시장 게임

  13. January 12th, 2025 at 23:14 | #13

    Many thanks, Ample postings!

  14. January 12th, 2025 at 23:26 | #14

    You need to take part in a contest for one of the best websites
    on the web. I am going to highly recommend
    this website!

  15. January 12th, 2025 at 23:35 | #15

    You’re so interesting! I don’t think I’ve
    read through anything like this before. So wonderful to discover somebody with a few unique thoughts on this issue.
    Really.. thanks for starting this up. This website is one thing that’s needed on the internet, someone with a little originality!

Comment pages
1 82 83 84 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
  10. June 17th, 2024 at 01:33 | #10
  11. July 9th, 2024 at 09:52 | #11
  12. July 29th, 2024 at 03:40 | #12
  13. September 16th, 2024 at 11:50 | #13
  14. October 19th, 2024 at 15:31 | #14
  15. October 22nd, 2024 at 18:24 | #15
  16. October 24th, 2024 at 04:17 | #16
  17. November 9th, 2024 at 10:01 | #17
  18. November 9th, 2024 at 11:51 | #18
  19. November 11th, 2024 at 04:18 | #19
  20. November 11th, 2024 at 06:33 | #20
  21. November 11th, 2024 at 07:08 | #21
  22. November 12th, 2024 at 02:12 | #22
  23. November 13th, 2024 at 08:00 | #23
  24. November 14th, 2024 at 06:12 | #24
  25. November 14th, 2024 at 14:35 | #25
  26. November 14th, 2024 at 16:23 | #26
  27. November 15th, 2024 at 05:09 | #27
  28. November 15th, 2024 at 05:46 | #28
  29. November 15th, 2024 at 11:13 | #29
  30. November 15th, 2024 at 11:46 | #30
  31. November 15th, 2024 at 19:12 | #31
  32. November 17th, 2024 at 04:29 | #32
  33. November 18th, 2024 at 05:00 | #33
  34. November 19th, 2024 at 12:11 | #34
  35. November 19th, 2024 at 19:46 | #35
  36. November 25th, 2024 at 21:09 | #36
  37. December 4th, 2024 at 00:57 | #37
  38. December 30th, 2024 at 18:41 | #38
  39. January 6th, 2025 at 21:21 | #39