If one uses [Embed] to refer to external graphic assets its easy to instantiate and use them.
However, I've got a png in an Fla, with the Class identifier set to "Symbols", Base class is BitmapData.
I need to instantiate it like this:
var symbols:BitmapData = new Symbols(1, 1);
Of course the compiler complains about a call to a possibly undefined method Symbols.
For a temporary fix I guess i'll put the graphic external to the swf, but for this project it needs to be in the library along with everything else.
If you have a symbol in your library with a Class identity of "Symbols" then you should only need to use...
var symbols:Symbols = new Symbols();
As far as the 1,1 argumets go, are those not something you could assign when the instance is created?
Well, the 1,1 is a red herring, just to ensure the new BitmapData instance is created with some dimensions (it gets the correct dimension from the bitmap)
The problem here is the disconnect between the class identifier in the library of a swf created in Flash.exe, and compiling it using an external compiler. If I followed your suggestion - var symbols:Symbols = new Symbols(); - the compiler would still complain about an unkown identifier.
Can't use Flash to compile, we use Maven/Flex-mojos. Why do it the simple way when you can hugely overcomplicate it?! Compilation has to be done in a DOS window and just to do a few classes takes a couple of minutes as all manner of Java malarkey takes place also. Our enterprise imposes a load of restrictions on how you can create code assets.
Yep, it is in a separate swf, but that wouldn't affect compilation. After a bit of checking around, I've created a Symbols class (as opposed to allowing Flash to create a default class when exporting the swf) that subclasses BitmapData and just contains a constructor. This allows a clean compile using the flexcompiler. Havent actually got it displaying yet but its a step in the right direction....
Europe, Middle East and Africa