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!
Patong Remains Phuket’s More Widely Used Beach Spot 광주휴게텔
Keep on writing, great job!
A Few Tips You Might Have For Perfect Limousine Service 마사지
The Gresso Sol – Luxury Cellphone 다바오충전 (Katharina)
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.
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
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.
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
Thanks for finally writing about >Flex 4: Changing the “displayAsPassword” default character
| eonflex.com <Loved it!
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!
Top Health Club Treatments Essential Try Today 하이오피주소
Live Music 선릉오피
Student A Car Loan – Investing In A Car Through Having An Ease 골드페이
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.
7 Guidelines Having Fun In Your Retail Store 오피
Pub Crawl 광주오피
Signature Drinks 하이오피
Clubbing 광주알밤
Mobile Phone Contracts Makes Users Enjoy A Better Telephonic Experience 다바오4989
Because the admin of this website is working, no doubt very
soon it will be famous, due to its feature contents.
Since the admin of this web site is working, no uncertainty very rapidly it will be famous, due to its quality contents.
Hurrah, that’s what I was seeking for, what a stuff! present here at this blog,
thanks admin of this site.