Note that there are some explanatory texts on larger screens.

plurals
  1. POEmbedding Fonts in AS3 - Dynamic Text Field disappears
    primarykey
    data
    text
    <p>This is hopefully a new problem or just me missing something obvious. Please help! I'm embedding a font into my AS3 application. I'm doing everything by-the-book and it half-works.</p> <p>In my main class,</p> <pre><code> [Embed(source="Art/moolbor.ttf", fontFamily="MoolEmbed", mimeType="application/x-font")] var MoolEmbed:Class; </code></pre> <p>Then later on in my code:</p> <pre><code> var newFormat:TextFormat = new TextFormat(); newFormat.font = "MoolEmbed"; newFormat.size = 20; newFormat.color = 0xFCF374; year.autoSize = TextFieldAutoSize.LEFT; year.text = "Hello World"; year.embedFonts = true; year.setTextFormat(newFormat); year.antiAliasType = "advanced"; </code></pre> <p>This works perfectly fine, and the text shows up beautifully. I can rotate it, alphas apply to it, and it's nicely antialiased. The problem is that the textfield is dynamic - Later on in the code:</p> <pre><code> year.text = "And a second hello world"; </code></pre> <p>As soon as this code is triggered, the textfield disappears completely. I turn on</p> <pre><code> year.border = true; </code></pre> <p>and I can see that the textfield is still there, but it's size has shrunk down to just a few pixels. Thinking perhaps it was the autoSize messing things up,</p> <pre><code> //year.autoSize = ...; </code></pre> <p>Same problems. Thinking it might be embedding, I commented out the line:</p> <pre><code> //year.embedFonts = true; </code></pre> <p>And the textfield returns to working status, but (Understandably) loses it's ability to do alphas and rotations.</p> <p>Any idea what's going on?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload