Skip to content
Feb 5 /

Setting a background image on a WindowedApplication container in Adobe AIR

The following example shows how you can set the background image on an Adobe AIR WindowedApplication container by setting the backgroundImage style.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2009/02/05/setting-a-background-image-on-a-windowedapplication-container-in-adobe-air/ -->
<mx:WindowedApplication name="WindowedApplication_backgroundImage_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        backgroundImage="mx.skins.halo.ApplicationBackground"
        backgroundSize="100%">
 
    <mx:Label text="backgroundImage = mx.skins.halo.ApplicationBackground" />
 
</mx:WindowedApplication>

You can also set the backgroundImage style in an external .CSS file or <Style> block, as seen in the following example:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2009/02/05/setting-a-background-image-on-a-windowedapplication-container-in-adobe-air/ -->
<mx:WindowedApplication name="WindowedApplication_backgroundImage_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle">
 
    <mx:Style>
        WindowedApplication {
            backgroundColor: white;
            backgroundImage: ClassReference("mx.skins.halo.ApplicationBackground");
        }
    </mx:Style>
 
    <mx:Label text="backgroundImage = mx.skins.halo.ApplicationBackground" />
 
</mx:WindowedApplication>

One Comment

leave a comment
  1. casey / Aug 14 2010

    where’s the link to the image?

Leave a Comment

Spam Protection by WP-SpamFree