I have the following code
///Get BitmapData from library in SWC
var ClassReference:Class = getDefinitionByName(products[i].producticon+"Data") as Class;
// Create new BitmapData Instance From it
var bitMapS:BitmapData = new ClassReference();
// Create new Class that contains Bitmap Data
var IconBitmap:Class = new AndroidAsset(bitMapS) as Class;
// Get String name from Class
var s:String = getQualifiedClassName(IconBitmap);
trace(s);
I get null in the trace. How do I make a dynamic class that I can refer to for this bitmap similar to how your reference a class from and embedded media?
I’m not sure I understand you question exactly, but it sounds like you want a way to get a copy of this bitmap data in a manner similar to creating a new instance of a class. If that’s the case, you could do something like this :
So, in a practical use scenario, your array of symbol definitions would be a member variable on some BitmapManager class or something. Then if you wanted to make it accessible from anywhere in your application, just make it a singleton, and presto – you can instantiate a new library asset from your SWC anywhere you need it with a call like this:
Or, a better way to do that would to be to add a method to BitmapManager like
so you could just call it up like this :
Hope that helps (if that was even you question to begin with) 😛