Create a dynamic instance of images you can change at runtime.
With Actionscript 3 it's possible to make an embedded image reusable using the Embed Metadata and creating a subclass of mx.core.MovieClipAsset
Only 3 Flex containers allow the use of layout="absolute" : Application, Panel and Canvas. Using the absolute positioning, you can create a layering effect on your application.
To overlap an image to a Panel, it's enough to create an instances of the embedded image class.
With Actionscript 3 it's possibile to create reusable embedded images with the following code :
[Embed(source="assets/logo.swf")]
[Bindable]
private var myIcon:Class;
Note that the data type I use is the Class. Then I used the variable as the source of the Image :
Flex automatically creates an instance of the class. It's possible to use the superclass for a SWF file creating a subclass of mx.core.MovieClipAsset:
import mx.core.MovieClipAsset;
[Embed(source="assets/logo.swf")]
public var myIcon:Class;
[Bindable]
public var myIcon_1:MovieClipAsset = new myIcon();
For overlapping the image on a Panel we just use the x and y property of the Image tag :
</mx:DataGrid>
</mx:Panel>
The cool thing is that using the bindable variable for images you can update the image at runtime and make it dynamic !