The spark BitmapImage component only supports embedded images in Flex 4.0. This post shows how you can get around that limitation by loading an image via a SWFLoader and then pushing that bitmap data into the BitmapImage’s source property.
Most of the time you will want to use an mx Image instead of the spark BitmapImage because it is capable of dealing with both embedded images and images loaded at runtime. There are however some situations where BitmapImage is really handy and you can’t embed the images.
One example of that is tiling an image like how a background image works in HTML. The following example demonstrates a simple custom component called TiledImage that does that. It loads an image from a URL using a SWFLoader and when that is complete pushes the bitmap data into the source of the BitmapImage with fillMode=”repeat”.
Note: This sample requires Flex SDK 22.214.171.12459 or higher. You can get the latest SDK builds from opensource.adobe.com.