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 17th, 2025 at 14:36 | #1

    Patong Remains Phuket’s More Widely Used Beach Spot 광주휴게텔

  2. January 17th, 2025 at 14:39 | #2

    Keep on writing, great job!

  3. January 17th, 2025 at 14:39 | #3

    A Few Tips You Might Have For Perfect Limousine Service 마사지

  4. January 17th, 2025 at 14:42 | #4

    The Gresso Sol – Luxury Cellphone 다바오충전 (Katharina)

  5. January 17th, 2025 at 14:45 | #5

    Hello there, You’ve done an excellent job. I’ll certainly digg it
    and personally recommend to my friends. I’m confident they will be
    benefited from this web site.

  6. January 17th, 2025 at 14:51 | #6

    The New York Lottery reports any prize with a value of $600 or more, as long as it is at least 300 times the wager.

    Feel free to visit my webpage … https://git.lunch.org.uk/carissa143041

  7. January 17th, 2025 at 14:57 | #7

    Hi there, You have done a fantastic job. I’ll definitely digg it
    and personally recommend to my friends. I’m confident they’ll be benefited from this site.

  8. January 17th, 2025 at 15:00 | #8

    I feel this is among the most vital information for me. And
    i’m happy reading your article. But wanna observation on some basic issues, The site style is great, the articles is
    in point of fact great : D. Just right task, cheers

  9. January 17th, 2025 at 15:15 | #9

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

  10. January 17th, 2025 at 15:26 | #10

    Howdy this is somewhat of off topic but I was wanting to know
    if blogs use WYSIWYG editors or if you have to manually code
    with HTML. I’m starting a blog soon but have no coding expertise so I wanted to
    get guidance from someone with experience. Any help would be enormously appreciated!

  11. January 17th, 2025 at 15:28 | #11

    Top Health Club Treatments Essential Try Today 하이오피주소

  12. January 17th, 2025 at 15:32 | #12

    Live Music 선릉오피

  13. January 17th, 2025 at 15:40 | #13

    Student A Car Loan – Investing In A Car Through Having An Ease 골드페이

  14. January 17th, 2025 at 15:46 | #14

    Aw, this was an extremely nice post. Finding the time and actual effort to generate a good article… but what can I say… I procrastinate a whole lot and don’t seem to get anything done.

  15. January 17th, 2025 at 15:46 | #15

    7 Guidelines Having Fun In Your Retail Store 오피

  16. January 17th, 2025 at 15:52 | #16

    Pub Crawl 광주오피

  17. January 17th, 2025 at 15:54 | #17

    Signature Drinks 하이오피

  18. January 17th, 2025 at 16:00 | #18

    Clubbing 광주알밤

  19. January 17th, 2025 at 16:03 | #19

    Mobile Phone Contracts Makes Users Enjoy A Better Telephonic Experience 다바오4989

  20. January 17th, 2025 at 16:07 | #20

    Because the admin of this website is working, no doubt very
    soon it will be famous, due to its feature contents.

  21. January 17th, 2025 at 16:30 | #21

    Since the admin of this web site is working, no uncertainty very rapidly it will be famous, due to its quality contents.

  22. January 17th, 2025 at 16:36 | #22

    Hurrah, that’s what I was seeking for, what a stuff! present here at this blog,
    thanks admin of this site.

Comment pages
1 103 104 105 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