Change the background of your window with your selected image.
Copy and paste the following code to your AIR file and view the result.

Note: Please make sure that you have an image in your application source folder.
Here the image name is “image.jpg” else you will get URL not found error.

xmlns:mx="" layout="absolute"  creationComplete="onCreationComplete(event)" height="800" width="800" >


            private var bgLoader : Loader;
            private var bgBitmapData : BitmapData;
// set your require background image path
            private var bgImagePath:String = "image.jpg";

backgroundImage="assets/myimage.jpg" height="800" width="800" >
backgroundImage="assets/myimage.jpg" will set as a background Image.

            private function onCreationComplete(event:FlexEvent):void
                bgLoader = new Loader ();
                bgLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, bgLoadingComplete, false, 0, true);
  &nbs p;             bgLoader.load (new URLRequest (bgImagePath));
            private function bgLoadingComplete (event:Event):void
                bgBitmapData = new BitmapData (bgLoader.width, bgLoader.height);
                bgBitmapData.draw ( bgLoader );

       (0, 0, stage.stageWidth, stage.stageHeight);


    id="bgCanvas" height="100%" width="100%" />

Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.