Setting a background image on a WindowedApplication container in Adobe AIR

by Peter deHaan on February 5, 2009 · 0 comments

in WindowedApplication

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>

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: