Search code examples
actionscript-3font-embedding

AS3 font embedding - Error message


I would like to embedd a font with AS3 using the "swf method".

The error I get is:

Font "myFont" could not be created ../assets/swf/myFont.swf cannot be transcoded.

As per Google this problem is because of a path-error. But I think I set the right path, didn't I?

My folder structure

main.fla
../com
..../subfolder
....../testButton
......../testButton.as
....../assets
......../swf
........../myFont.swf

in my testButton.as I'm trying to embedd the myFont.swf:

public class testButton extends Sprite {
[Embed(source="../assets/swf/myFont.swf", fontName="myFont",
        fontWeight='bold', mimeType="application/x-font")] 
        private var myEmbeddedFont:Class;

In the main.fla I'm creating an object of the class.


Solution

  • Just convert the original font file into a .otf and install it. Flash will detect it and you'll be able to use it like a normal font without the embedding.