Make the Label component more like a button
I don’t know about you but I find myself using the Label component fairly often to make something like a regular old HTML link. But it really wasn’t meant to do that.
| view source |
First, you can put htmlText in the Lable TextField but you can’t actually type HTML code in the htmlText MXML attribute. So you have to work around that. And, you have to specify:
buttonMode="true"
mouseChildren="false"
useHandCursor="true"
Gee, it’s a frakking link. I’d like it to behave like one when the user mouses over it.
Plus, if you want said link to actually navigate to another html page you have to do all that URLRequest and navigateToURL stuff.
So, I extended the Label component and tossed in all this stuff so that it’s so easy even a Republican nominee for vice president could do it. Well, maybe not that easy. But you get the point. :-)
As an example, to make the middle link above all you need to do is write this MXML code:
<extenders:LableBtn
linkText="Simeon Says ( opens in new window )"
window="_new"
linkURL="http://blog.simb.net/" />
See, told you it was easy.
If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.






