Skip to main content
Known Participant
May 8, 2010
Answered

2nd Font WONT embed. Keep getting error: 1151 A conflict exist-HELP

  • May 8, 2010
  • 1 reply
  • 727 views

I am trying to embed a font. It is the same font but, different sizes ( I dont know if that matters, one size is 11 the other is 15).  I set up my actionscript as so (please see below), but I continue to get this error message: 1151 A conflict exist  with definition dtText2 in namespace internal. WHAT I AM DOING WRONG?  And do I need another set of code if I am using the same font but instead of size=15; I am using size=11;?    PLEASE HELP.

var font3:Font=new Font3();

var dtFormat:TexFormat=new TextFormat();

var dtText2:TextField=new TextField();

dtFormat.Font=Font3.fontName;

dtFormat.size=15;

dtText2.autoSize=

TextFieldAutoSize.CENTER;

dtText2.defaultTextFormat=dtFormat;

dtText2.embedFonts=true;

Why is it giving me error 1151 A conflict exist.....?  I have tried changeing the name of my var dtText2, and I even instance my dynamic Text, naming it myText2 but I continue to get errors.  Can anybody help I have been working on embeding fonts for days now and continue to get stuck.

Thanks for anything that you can do.

This topic has been closed for replies.
Correct answer kglad

Thank you. i will mark this as answered. thanks again.


you're welcome.


1 reply

kglad
Community Expert
Community Expert
May 8, 2010

first, you should be using:

var font3:Font=new Font3();

var dtFormat:TexFormat=new TextFormat();

var dtText2:TextField=new TextField();

dtFormat.font=font3.fontName;  // notice the cases.  you had 2 errors on this line

dtFormat.size=15;

dtText2.autoSize=TextFieldAutoSize.CENTER;

dtText2.defaultTextFormat=dtFormat;

dtText2.embedFonts=true;

second, you don't need to embed a font twice if the only change is size.

HTIMS_GAuthor
Known Participant
May 8, 2010

Thanks you. What script would I use if I have the same font but different sizes? Do I leave the autoSize blank?

kglad
Community Expert
Community Expert
May 8, 2010

if you want to use the same font but different size/color etc, just create a different textformat instance or you could re-use the one you already defined:

var font3:Font=new Font3();

var dtFormat:TexFormat=new TextFormat();

var dtText2:TextField=new TextField();

dtFormat.font=font3.fontName;

dtFormat.size=15;

dtText2.autoSize=TextFieldAutoSize.CENTER;

dtText2.defaultTextFormat=dtFormat;

dtText2.embedFonts=true;

//

var dtfFormat3:TextFormat=new TextFormat();

var dtText3:TextField=new TextField();


dtFormat3.font=font3.fontName;

dtFormat3.size=22;

dtFormat3.color=0xaa0000;

dtText3.autoSize=whatever

dtfText3.defaultTextFormat=dtFormat3;

dtText3.embedFonts=true;

it only gets tricky when you want bold or italic or bold and italic fonts embedded.  those are different fonts and those need to be embedded seperately.