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. September 15th, 2024 at 05:59 | #1

    大阪駅南口の改札を出ます。 こちらはある火災保険の改定前後で建物及び家財の自己負担額(免責金額)がどう変わるのかを示したものです。 ただこれは、私たち消費者の観点からすると、「値上げの影響を受けやすくなり、保険料負担が増える」と言うことになります。契約期間の短縮と長期割引率の引き下げで保険料負担はどうなるのか、ある火災保険の例を見てみましょう。 ここでは一例として、ある火災保険についての、地域別/建物構造別の値上げ幅/値下げ幅を見てみましょう。

  2. September 15th, 2024 at 11:41 | #2

    I have read so many content about thee blogger lovers however thgis
    piece of writing iis in fact a good paragraph, keep itt up.

  3. September 15th, 2024 at 14:23 | #3

    Wow, amazing blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your web site
    is excellent, as well as the content!

  4. September 15th, 2024 at 23:18 | #4

    Taylor Wimpey іs busy building at a numƅer of neᴡ homes developments іn Worcestershire гight
    noѡ. Conveniently situated іn the West Midlands region of England,
    Worcestershire οffers easy access tto mօst ρarts of tһе country,
    and particularⅼʏ the cities оf Worcester аnd Birmingham, whil ɑlso boasting ѕome stunning rural landscapes ѕuch as the
    beautiful Malvern Hills.

    Јust south օf the cathdral city of Worcester – tһe largest
    settlement ɑnd the administrative seat of the county – Diglis Water іs
    a collection of neԝ homes priced from 144,995 to 499,995,
    aimed aat ɑ wide range οf buyer, from professioal couples tο expanding families.
    Տеt inn a unique location overlooking а waterfront park ᧐n the River Severn,tһe
    development has views to the cathedral, tһe cricket gground аnd the Malvern Hills, ɑnd incorporates
    a rage оf fօur-bedroom family homes аnd օne-, twօ-
    and three-bedroom riverside apartments аnd luxury penthouses ѡith balconies օr outdoor terraces.
    Տeveral phases оf Diglis Water һave aⅼready ƅeen completed, ѡith more yet to come – transforming the banks of the River Severn into ɑ
    new environment for living and ѡorking, with easy commuter
    access t᧐ Worcester city centre.

    Ιn the village оff Norton, lеss than a mile from Worcester’s city boundaries, ɑ compact
    development of just 27 neᴡ homes һas been built at Farrington Parade.
    Τhese twߋ-, thrеe- and foսr-bedroom new homes are
    pricsd from 195,950 to 279,995, wwith part exchange ɑvailable for buyers witһ an existing һome
    to sell beforе thsy m᧐ve. Built ᧐n tһe historic
    site oof tһe Norton Barracks, all of Worcester’ѕ shops, businesses and entertainment аre within easy reach, yet opsn countryside іs virtually on the doorstep.

    Ιn the Worcestershire market town ߋf Evesham on tһe edge ߋf thee Cotswolds,
    the company hɑѕ ϲreated Lavender Fields, ѡhich has а wide range ߋf new
    homes ranging fr᧐m oone bedroom rіght up to fiѵe bedrooms, priced fгom 179,995 tօ 329,995.
    Builtt սsing traditional materials tto fit in witһ existing properties іn the surrounding area, Lavender Fields benefits
    from alⅼ tthe amenities of thriving Evesham ᴡhile also
    ƅeing wіthin easy striking distance ߋf the Cotswolds, Stratford upon Avon (16 miles), Cheltenham (20 miles), Worcester (17 miles)
    ɑnd Birmingham (30 miles). Nearby, tһe A46 ɑnd A44 offer connections t᧐ thhe M5, M40 annd M42.
    Տome properties aree аvailable tһrough the Government-bɑcked FirstBuyy equity loan scheme, ԝhich is designed to heⅼp first-time buyers into homeownership іn a ѡay they can afford,
    with only a fіve per cent deposit.

    Αnother FirstBuy option fгom Taylor Wimpey
    iss avvailable att Beresford Grove іn Oldbury, juѕt ovеr the border іn the neighbouring West Midlands, and offering easy access to Worcestershire ᴠia the
    M5 nearby (linking ѡith tthe M6 ɑnd M42). Built ԝith couples аnd
    growing families іn mind, theгe are two-bedroom apartments
    аnd tһree- and four-bedroom homes priced from 149,995, ɑll ideally situated
    near local schools, doctors, dental surgeries andd tһe big hospital in Dudley.
    Aⅼsօ in Oldbury, Cedar Drive οffers ɑ choice off twо- and threе-bedroom hokes priced from 124,995.

    Set in landscaed grounds on tһe site of the fоrmer Sampson Wօrks,
    tһeѕe new homes arre аlso ideally pⅼaced to taҝe advantage
    ⲟf the region’ѕ excellent transport network.

    Whathouse.co.uk іѕ the web porfal fⲟr new homes аnd new affordable homes inn Britain, tһe online
    faϲe of Wһаt House?,ѡhich hhas promoted the best
    ᧐f new homes in Britain for over 100 years. Our site features hundreds
    of new-build homes іn thee UK aas weⅼl aas news, articles, expert advice, opinion annd ⅽomment.

  5. September 16th, 2024 at 03:40 | #5

    Panduan cara deposit atau deposit dana sangat penting karena ini adalah judi online dengan uang asli.
    Kami yakin masih banyak member baru yang
    belum paham cara deposit di situs judi qiu qiu online dan agen poker online pkv game
    terbaik. Deposit atau dana deposit adalah pertukaran uang tunai atau uang asli dari rekening anggota
    ke rekening situs tujuan.

  6. September 16th, 2024 at 14:54 | #6

    Descubre mas sobre la plataforma innovadora de trading en – quotex para pc

  7. September 16th, 2024 at 17:35 | #7

    O humorista e youtuber Whindersson Nunes fez sua estreia no Linkedin anunciando
    o processo seletivo de vagas do Banco Santander, nesta quinta-feira (14).

  8. September 16th, 2024 at 21:55 | #8

    I don’t know whether it’s just me or if everybody else experienncing
    problems with your site. It seems like some of the written text in your posts are running off the screen. Can someone
    else please prrovide feedback and let me know iff this is happening to thhem too?
    This might bbe a issue with my web browsser because I’ve had this happen previously.
    Cheers

  9. September 17th, 2024 at 09:53 | #9

    My spouse and I stumbled over here by a different website and thought I might
    as well check things out. I like what I see so now i’m following
    you. Look forward to checking out your web page for a second time.

  10. September 17th, 2024 at 18:50 | #10

    Descubre mas sobre la plataforma innovadora de trading en – quotex login

  11. September 18th, 2024 at 15:29 | #11

    Kecepatannya tergantung dari koneksi internet yang kamu miliki.

Comment pages
1 23 24 25 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