If you’ve ever won­dered whether it’s pos­si­ble to apply a gra­di­ent on a Flex Label, well it is ; but that’s not very straight for­ward… As I’m work­ing on a app that requires this kind of glit­ter I decided to try and see what could be done.

I started with a basic Action­Script project (no Flex involved) and came up with this. Quite func­tional, could prob­a­bly be opti­mized but my goal was actu­ally a Flex com­po­nent and I knew that was tech­ni­cally fea­si­ble. I then sim­ply extended Flex’s Label class and basi­cally copied/pasted the logic into it. Just had to fig­ure out which event to lis­ten to and I was good to go…

Here’s a demo app for your play­ing pleasure.

Go get Flash!

You may notice that in this exam­ple I embed the font so it looks nicer, but this is not mandatory…

All this is open­source (class+project) and you can grab it at my brand new Google Code dump: as3-bits. Help yourself.

As always, feed­back welcome.