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!
I really like what you guys are usually up too.
This kind of clever work and exposure! Keep up the amazing works guys I’ve included you guys
to blogroll.
hey there and thank you for your information – I’ve definitely picked up
something new from right here. I did however expertise a few technical points using this website, as I experienced to reload the web site many times previous to I could get it to
load correctly. I had been wondering if your web hosting is OK?
Not that I’m complaining, but sluggish loading instances times will sometimes affect your placement in google and can damage your
high quality score if ads and marketing with Adwords. Anyway I
am adding this RSS to my email and could look out for
a lot more of your respective intriguing content. Ensure that you update this again soon.
Fun Team Building Events Ideas Help To Make Your Corporate Event Popular 하이오피사이트
Dallas Has Entertainment For Several Tourists 광주알밤
Guide To Best Uk Destinations For Almost Any Weekend Break 하이오피
Using Financing Calculator To Discover Your Mortgage Term 다바오 lgbt 호텔
My Cheerful Sojourn To Bangkok – I Simply Wish To Revisit 광주키스방 (Mose)
Greetings from California! I’m bored at work so I decided to browse your site on my iphone during lunch break.
I really like the information you provide here and can’t wait to take a look when I get home.
I’m surprised at how fast your blog loaded on my phone ..
I’m not even using WIFI, just 3G .. Anyhow, amazing blog!
When some one searches for his necessary thing, so he/she needs to be available that in detail,
so that thing is maintained over here.
I could not resist commenting. Well written!
I’m extremely inspired with your writing abilities
and also with the layout to your weblog. Is that this
a paid theme or did you modify it yourself? Anyway stay up the
excellent high quality writing, it is rare to look
a nice blog like this one these days..
I am actually pleased to read this webpage posts which carries lots of helpful information, thanks for providing
these information.
Please let me know if you’re looking for a article author for
your weblog. You have some really good articles and I feel I would be a good asset.
If you ever want to take some of the load off, I’d love to
write some content for your blog in exchange for a link back to
mine. Please send me an email if interested. Regards!
Hi, I think your site might be having browser compatibility issues.
When I look at your blog in Opera, it looks fine but when opening in Internet Explorer,
it has some overlapping. I just wanted to give
you a quick heads up! Other then that, excellent blog!
When someone writes an article he/she maintains the plan of a
user in his/her brain that how a user can be aware of it.
So that’s why this piece of writing is great. Thanks!
VIP Experience 부달
Hi, constantly i used to check blog posts here early in the dawn, as i love to gain knowledge of more
and more.