I have the following class which embeds an image as a class:
import mx.core.BitmapAsset;
public class MyClass extends MyBaseClass
{
[Embed(source="assets/myPNG.png",scaleGridTop=7,
scaleGridBottom=46,scaleGridLeft=7,scaleGridRight=46)]
public var myPNG:Class;
public function MyClass():void{
super();
init();
}
private function init():void{
// Example 1:
// This instance works to supply the embedded image
// but is missing the scale9Grid property
var myClass:Class = this["myPNG"];
var bitmapAsset1:BitmapAsset = new myClass() as BitmapAsset;
// Example 2:
// This inscae works and is complete with the scale9Grid
// property supplied through embedding.
var bitmapAsset2:BitmapAsset = new myPNG() as BitmapAsset;
}
}
So far the scale9Grid property is missing in Example 1, but I fear
other properties may be missing as well.
Does anyone know how to correct this problem? Is there a better way
to dynamically access and instantiate the class myPNG at runtime?