Though this is not necessarily for a specific problem, I have created a sample application through which we can set the background for the application or components.
Sample application shown how to do that.
Here is a sample code to set background for the application or components.
//////////////////////////////////////// Code Start //////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onCreationComplete(event)">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var bgLoader : Loader;
private var bgBitmapData : BitmapData;
private var bgImagePath:String = "assets/images/Tulips.jpg"; // set your require path
private function onCreationComplete(event:FlexEvent):void
{
bgLoader = new Loader ();
bgLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, bgLoadingComplete, false, 0, true);
bgLoader.load (new URLRequest (bgImagePath));
}
private function bgLoadingComplete (event:Event):void
{
bgBitmapData = new BitmapData (bgLoader.width, bgLoader.height);
bgBitmapData.draw ( bgLoader );
bgCanvas.graphics.beginBitmapFill (bgBitmapData);
bgCanvas.graphics.drawRect (0, 0, stage.stageWidth, stage.stageHeight);
bgCanvas.graphics.endFill ();
}
]]>
</mx:Script>
<mx:Canvas id="bgCanvas" height="100%" width="100%" />
</mx:Application>
//////////////////////////////////////// Code End //////////////////////////////////////////////////////
This may help.
Regards,
Virat Patel
+