1
votes

In my game project previously all HUD elements were in the main FLA file. I'm now moving them to an external SWF file to clean up my project.

However I've hit an issue which I don't quite understand.

As a test case I moved over one HUD element to a new FLA file and compiled that to SWF. I successfully load that using ActionScript 3. Without any further code changes the HUD element shows up where it did before, but all dynamic text fields either: a) don't show text b) show text in a wrong position in the textfield (cut off where it exceeds the fields' boundaries) Static text shows fine. I'm guessing hit has to do something with font embedding.

I'm using a single font, which I embedded in my main FLA. For my HUD FLAI tried three things, but all had the exact same result: 1) not embedding the font 2) making sure the embed settings were identical to that of the main FLA 3) making sure the name of the embed settings was different from the main FLA

I'm using classic text.

The following link to an image illustrates what goes wrong. Left loads the SWF with the HUD element, right had the HUD element in the main SWF. As you can see some text is shifted other is completely absent.

difference (unfortunately I'm not allowed to posts images...)

Any help would be greatly appreciated!

1
I think it's a positioning problem of your text fields, try to verify that.akmozo
Nope the text fields are at exactly the right position. Tracing confirms that.paup
I found a work-around. If I change the font to a completely different font in the loaded SWF, it displays fine. It appears Flash gets confused because the same font is used twice?paup
Hi, can you try "textfield.embedFonts=false;" can be rendered correctlyMuhammet Demir
Thanks @mdemir that works. I've now added that line for all text fields in the constructor of the UI element and it displays all text as it should! If you post your reply as an answer I can mark it as such.paup

1 Answers

1
votes

can you try

textfield.embedFonts=false; 

can be rendered correctly