It's really nice once you get to grips with stuff.
Things to remember:
When you create an instance of an asset, you should cast it when you
create it - I had all sorts of problems and was having to create my
assets as children of Sprites until I discovered this:
var myMC:MovieClip = new ImportedMCAsset() as MovieClip;
You can import sounds, but I have not managed to embed sounds in a
MovieClip and get it working, there was something somewhere which
mentioned trying to cast the MC as a SoundAsset, but this is how I got
it working:
[Embed (source = "../resources/sounds/bomb.mp3")]
private var SndBomb:Class;
var bomb:SoundAsset = new SndBomb() as SoundAsset;
You can also embed fonts from the system:
[Embed(systemFont="Tahoma", fontName='TextFont', fontWeight='bold',
unicodeRange='U+002C-U+005A', mimeType='application/x-font') ]
private var AnotherClass:Class;
Or from a library:
[Embed(source="../library/tahomabd.ttf", fontName='myFont',
fontWeight='bold', unicodeRange='U+002A-U+002A',
mimeType='application/x-font') ]
private var AssetClass:Class;
And use it like this - even if you embed the font in the main class and
access it in a child clip (not sure if this works for other clips):
var label:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.font = "TextFont";
format.bold = true;
format.color = 0xFFFFFF;
label.htmlText = "Embedded fonts";
label.embedFonts = true;
label.setTextFormat(format);
addChild(label);
HTH
Glen
Gregory N wrote:
Thanks a lot to all who replied, and especially to Glen.
This article at bit-101.com is great!
Among other things, I'm trying to find "new" way to collaborate with
designers who create graphics in Flash IDE (8 or 9).
And so far it seems I've found it.
--
Glen Pike
01736 759321
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders