0
votes

I have inhereted a project and need to re-style for use with another company and I am having trouble changing the currently embedded font, DIN Next LT Pro, with Helvetica Neue

I am new to flash and AS3 so really learning this from the ground up. Saying that I have spent the last day researching this problem on google and trying a multitude of solutions to no avail.

Here is how the flash is set up.

feedback.fla which has the following fonts embedded:

  • DIN Next LT Pro Bold Condensed
  • DIN Next LT Pro Light Condensed
  • DIN Next LT Pro Regular
  • Helvetica Neue LT Std 45 Light
  • Helvetica Neue LT Std 55 Roman
  • Helvetica Neue LT Std 75 Bold

The DIN fonts were already installed. I added the Helvetica font by clicking embed, adding a font name the same as the font but without spaces eg: HelveticaNeueLTStd75Bold.

FeedbackPage.as seems to specify the fonts to be used and apply them to a tag:

public class FeedbackPage extends AbstractPage {
    public static const FONT_BOLD : String = "DIN Next LT Pro Bold Condensed";
    public static const FONT_LIGHT : String = "DIN Next LT Pro Light Condensed";
    public static const FONT_REGULAR : String = "DIN Next LT Pro";
    etc.. etc..

FeedbackPage.as also imports another .as file:

import dk.electric.synoptik.components.feedbackelements.PercentFeedback;

PercentFeedback.as This file creates the text fileds and applys the font:

var tfmtPercent : TextFormat = new TextFormat(FeedbackPage.FONT_BOLD, fontSize, 0x0a9fda);
_tfPercent = TextFieldUtils.createTextField(6, yPos, 150, 95, Math.abs(pctDif).toString() + "%", tfmtPercent, false, TextFieldAutoSize.NONE);
_sprContainer.addChild(_tfPercent);

After embedding my new font Helvetica Neue LT Std 75 Bold to the fla file I change the FeedbackPage.as to:

public static const FONT_BOLD : String = "Helvetica Neue LT Std 75 Bold";

Export my fla, upload and take a look and the text has disappeared. I have tried using the name you assign when you embed (HelveticaNeueLTStd75Bold) but this does not work either.

Any ideas as I am massivly stuck?

TextFieldUtils

package com.madsb.utils {
    import flash.text.TextField;
    import flash.text.TextFormat;

    public class TextFieldUtils {

        public static function createTextField(x : Number = 0,
            y : Number = 0,
            width : Number = 100,
            height : Number = 100,
            text : String = "",
            textFormat : TextFormat = null,
            multilineWordWrap : Boolean = false,
            autoSize : String = "none",
            embedFonts : Boolean = true,
            antiAliasType : String = "advanced",
            selectable : Boolean = false) : TextField {

                var tf : TextField = new TextField();
                tf.x = x;
                tf.y = y;
                tf.width = width;
                tf.height = height;
                tf.embedFonts = embedFonts;
                tf.selectable = selectable;
                tf.multiline = tf.wordWrap = multilineWordWrap;
                tf.autoSize = autoSize;
                tf.antiAliasType = antiAliasType;
                tf.defaultTextFormat = textFormat;
                tf.htmlText = text;

                return tf;
            }

    }
}
1
Show the code for TextFieldUtils.createTextField() for starters...Torious

1 Answers

0
votes

Try using an embedded font by putting it in the library (that way people can also see it if they don't have that font installed on their computer) and making a var from it. Then set the font to that name (myFormat.font = myFont.fontName; where myFormat the name is of your TextFormat, and myFont the variable name of your font. the part 'fontName' should be kept like this and not also the name of your font)

Also, I'm not sure but I think that because "Helvetica Neue LT Std 75 Bold" and "HelveticaNeueLTStd75Bold" aren't the same (because one has spaces), flash might not understand which font you're referring to.