1

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!

Abubakr Dar
  • 4,078
  • 4
  • 22
  • 28
paup
  • 23
  • 5
  • I think it's a positioning problem of your text fields, try to verify that. – akmozo Feb 14 '15 at 22:27
  • Nope the text fields are at exactly the right position. Tracing confirms that. – paup Feb 14 '15 at 22:42
  • 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 Feb 14 '15 at 22:46
  • Hi, can you try "textfield.embedFonts=false;" can be rendered correctly – Muhammet Demir Feb 15 '15 at 21:23
  • 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 Feb 24 '15 at 17:54

1 Answers1

1

can you try

textfield.embedFonts=false; 

can be rendered correctly

Muhammet Demir
  • 1,995
  • 5
  • 21
  • 42
  • This was indeed the solution. I was under the impression that if you don't manually embed the font in the Flash library the font would not be embedded, but apparently it still is at compile time unless it's specifically marked not to. – paup Feb 24 '15 at 20:33