tags:

views:

210

answers:

1

I'm trying to embed a font in Flex and the code I'm using looks the same as the example, but throws an error. This is the code I've written:

[Embed(source="data/posca_mad_thrasherz/posca_mad_thrasherz.ttf",
    fontName = "fontGraffiti",
    fontWeight = "bold",
    mimeType="application/x-font")];
private var funFont:Class;

But I get the error, "Metadata requires an associated definition." I can't seem to get rid of it. Any ideas?

+2  A: 

Get rid of the semicolon at the end of your Embed statement: http://www.flash-db.com/Board/index.php?topic=17500.0;wap2

Michael Todd
sheesh, that's embarassing. Good to know, though. BTW, I get another error once that's taken care of, and it may have to do with my font. I now get 2 errors. One says, "Unable to resolve 'data/posca_mad_thrasherz/posca_mad_thrasherz.ttf' and the other states, "Unable to transcode 'data/posca_mad_thrasherz/posca_mad_thrasherz.ttf.'Is this just b/c of the font I chose? It's a ttf, which seems like it ought to work.
staypuffinpc
I'm not familiar with "unable to resolve", but it _sounds_ like either it can't find the font or it can't "parse" it (which is more likely due to the "unable to transcode" error). The only thing a quick search on Google revealed is that perhaps you should try putting a "/" before "data/posca...". I'm not sure that would work, but it seems to have helped others with those errors.
Michael Todd
OK, I kept trying to fix it until I realized the project was in a completely different folder than I believed I'd put it in. Go figure.
staypuffinpc