views:

8

answers:

1

I have a main.fla, in the library, i created two new fonts: RegularFont and BoldFont.

And I found the following piece of code somewhere, which works fine!

var regularFont:Font = new RegularFont();
var boldFont:Font = new BoldFont();
var regular:Object = {fontFamily:regularFont.fontName};
var bold:Object = {fontFamily:boldFont.fontName};

var ss:StyleSheet = new StyleSheet();
ss.setStyle(".bold", bold);
ss.setStyle(".regular", regular);

testFld.embedFonts = true;
testFld.styleSheet = ss;
testFld.htmlText = "<span class='regular'>testing </span><span class='bold'>123</span>";

// I can see the embedded regular font and bold font in a same dynamic html textfield correctly.

BUTTTTTTTTTTTTTTTTTTTTTT

In my actual project implementation, I have to host the fonts hosted in another swf. So I simply modified in this way:

Instead of declaring new font the in the main.fla, i imported the BigFont and RegularFont from another fonts.swf (dynamic fonts sharing)

HERE COMES THE PROBLEM, THESE TWO LINES WONT COMPILE

var regularFont:Font = new RegularFont();
var boldFont:Font = new BoldFont();

Flash IDE is throwing this error: 1180: Call to a possibly undefined method RegularFont.

WHYYYYYYYYYYYYYYYYYYYYYYY?

A: 

because you have no longer defined RegularFont or BoldFont in the compiler presumably. you have to extract the classes from the other swf, like so:

font SWF

shortstick