Setting the accent color on the MX Alert control default button in Flex 4

The following example shows how you can set the accent color on the MX Alert control’s default button in Flex 4 by setting the new accentColor style.

Full code after the jump.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see To download the latest nightly build of the Flex 4 SDK, see

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Halo_Alert_accentColor_test"
        <s:Button id="btn"
                label="Show alert"
                click="init();" />
        @namespace s "library://";
        @namespace mx "library://";
        mx|Alert {
            accentColor: red;
            import mx.controls.Alert;
            protected function init():void {
      "Mauris sem nisl, feugiat at fermentum eget, lacinia et nisi. Aenean vitae elit purus, et placerat quam. In justo odio, euismod vel vestibulum ac, tincidunt sit amet lectus. Aliquam non est felis, at lacinia metus. Sed odio magna, adipiscing auctor elementum eu, tempus vitae tellus. Suspendisse varius felis ac ligula pellentesque egestas lobortis mauris hendrerit. Duis vulputate, leo vel lobortis aliquet, dui nunc scelerisque lacus, at convallis ipsum enim et ipsum. Aenean id posuere felis. Nullam bibendum sapien nec dui vehicula ullamcorper. Curabitur placerat auctor erat eget tristique. ", "Lorem ipsum dolor sit amet, consectetur adipiscing elit", Alert.YES|Alert.NO|Alert.OK|Alert.CANCEL);

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

3 thoughts on “Setting the accent color on the MX Alert control default button in Flex 4

  1. Hi,

    Just want to thank you for a great blog, hope you guys blogging forever! :D
    I curious why you’re not have any live demos for Flash Builder?



    1. @Andreas,

      I haven’t been posting SWFs on the blog lately because they take a lot of extra time, plus the Flex 4 API is still somewhat changing which means I’ll eventually have to redo all these examples anways so they compile in the final Flex 4.0 release SDK (and then deleting all the old example SWFs and reposting them is a lot of extra extra work).

      One day all of these should have examples (or not, depending on how much work it is). Depends on if I want to spend all my time playing with old examples or writing new content.


Comments are closed.