I would like a preface to this wall of text, saying that I am very new to this. Perhaps I missed something obvious.
I am working in Flash CS5 with Actionscript 3. I am trying to use actioncript to create a text field and populate it with text. I put my font into my project using the "Font Embedding" window. However, when the code to create the text field is run, if "embedFont = true;", the font is invisible. The cursor is still changing when it runs over it, so I know it there. At least this is a text box. Dynamic text fields with embedded text that are already on the scene appear to be unaffected.
I tried changing the format of the embedded fonts, not working. I tried to directly insert the font with the "embed" tag using actionscript, but it doesn't seem to work with CS5, or I don't know what I'm doing. As you can see in the code above, I tried to "register" the font without success. I tried using:
var font:Font = new screenfont();
var format:TextFormat = new TextFormat();
format.font = screenfont.fontName;
No dice.
I followed various implementation tutorials and came across a lot of conflicting, confusing information. I read several different posts related to this topic, but have not yet found any viable solutions.
Here is a simple version of my code where “screenfont” is the name specified in the Font Embedding window:
Font.registerFont(screenfont);
var listformat:TextFormat = new TextFormat();
listformat.align = TextFormatAlign.LEFT;
listformat.size = 20.8;
listformat.color = 0x0DAC54;
listformat.font="Fixedsys Excelsior 3.01";
var photolist:TextField = new TextField();
photolist.x = photos_x;
photolist.y = tempY;
photolist.width = photos_wdth;
photolist.height = photos_hght;
photolist.text = photoname;
photolist.embedFonts = true;
photolist.antiAliasType = AntiAliasType.ADVANCED;
photolist.defaultTextFormat=listformat;
photolist.selectable = false;
photolist.wordWrap = true;
mediapage.photos.addChild(photolist);
I hope this gives a clear picture.
So, how exactly is it being implemented in CS5?
source
share