Copy link to clipboard
Copied
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);
addChild(new Bitmap(symbols));
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.
Copy link to clipboard
Copied
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();
addChild(symbols);
As far as the 1,1 argumets go, are those not something you could assign when the instance is created?
Copy link to clipboard
Copied
(if Symbols is extends the bitmapdata class, he'll need to create a bitmap to create a displayobject.)
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
flash would compile that without problem.
what compiler are you using?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i can't help you with that compiler. but i don't see why it would be a problem when flash wouldn't.
is Symbols in a swf that's loaded by a main swf?
Copy link to clipboard
Copied
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....
Copy link to clipboard
Copied
check the applicationdomain class.
Copy link to clipboard
Copied
You can embed symbol from external swf using syntax:
[Embed(source = 'swfName.swf', symbol = 'Symbols')]
Given swfName is in the same directory as your top level class.