Archive for July 25th, 2007

25
Jul

Changing the default button labels on an Alert control

When I first started playing with the Alert control, this tripped me up for a couple minutes. When trying to override the default text on the Alert control’s buttons, you need to set the Alert.cancelLabel, Alert.noLabel, Alert.okLabel, and/or Alert.yesLabel static properties *before* calling the Alert.show(). Sure, sounds a bit obvious in hindsight, but it is also important to remember that since those values are static, they apply to all Alerts, not just the one specific Alert. So you may have to reset the values back to their defaults once the Alert has been displayed.

Full code after the jump.

Continue reading ‘Changing the default button labels on an Alert control’

25
Jul

Formatting colors as strings with ActionScript

Here’s a pretty weak tip, but maybe somebody out there will find it useful. Often when working with colors, you need to format the text before displaying it, otherwise blue may display as “ff” and black as “0″. Here’s a semi-handy tip for making sure numbers display as hex values with at least six characters (and all uppercase, no less).

Continue reading ‘Formatting colors as strings with ActionScript’

25
Jul

Embedding assets from SWF files

Another cool way to embed assets into a Flex application is to load a SWF file and embed specific library assets using the [Embed] metadata and specifying the library symbol to embed.

Full code after the jump.

Continue reading ‘Embedding assets from SWF files’

25
Jul

Embedding images using style sheets and the <mx:Style> tag

Just when you thought I may have run out of Embed examples… Here’s a quick example of embedding an PNG icon using an <mx:Style> block.

Full code after the jump.

Continue reading ‘Embedding images using style sheets and the <mx:Style> tag’