Skip to content
Dec 16 /

Setting a custom text format on a WindowedApplication container’s title bar in Adobe AIR

The following example shows how you can set a custom text format on a Adobe AIR WindowedApplication container’s title bar by setting the titleTextStyleName style.

Full code after the jump.

Download WindowedApplication_titleTextStyleName_test

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2008/12/16/setting-a-custom-text-format-on-a-windowedapplication-containers-title-bar-in-adobe-air/ -->
<mx:WindowedApplication name="WindowedApplication_titleTextStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        title="WindowedApplication title"
        titleIcon="@Embed('assets/iconCritical.png')"
        titleTextStyleName="boldRed">
 
    <mx:Style>
        @font-face {
            src: url("assets/ARIALBD.TTF");
            fontFamily: "ArialEmbedded";
            fontWeight: "bold";
        }
 
        .boldRed {
            color: red;
            fontFamily: "ArialEmbedded";
            fontSize: 24;
            fontWeight: bold;
        }
    </mx:Style>
 
</mx:WindowedApplication>

In order to see the title icon and custom font, you also need to edit your AIR application’s XML file and change the following values:

<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<systemChrome>none</systemChrome>
 
<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
<transparent>true</transparent>

windowedapplication_titletextstylename_test

One Comment

leave a comment
  1. Greg L / Jan 28 2009

    I sure can’t duplicate this example (or any other I’ve tried). Do you know if something has changed with AIR 1.5 that breaks this? I created a brand new AIR app in Flex builder (plugin) 3.2, cut/pasted your code, made the two changes to the -app.xml, published it. The only thing I’ve done differently (that I can think of) is to use a different .png file since I didn’t have access to yours.

Leave a Comment