<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
<mx:Script>
<![CDATA[
import mx.containers.Panel;
import mx.core.BitmapAsset;
[Embed(source='bg2.png')]
public var bg:Class;
import mx.core.UIComponent;
private function init():void
{
var s:Shape = new Shape();
var u:UIComponent = new UIComponent();
u.addChild( s );
this.addChild( u );
var bd:BitmapData = new bg().bitmapData;
s.graphics.beginBitmapFill( bd, null, true );
s.graphics.drawRect(0,0, 3500, 3500); s.graphics.endFill();
var p:Panel = new Panel();
p.x = 100;
p.y = 100;
p.height = p.width = 300;
this.addChild( p );
}
]]>
</mx:Script>
<mx:Button x="31" y="37" label="Show Background" click="init()"/>
</mx:Application>