Jump to content
Search Community

Loading fonts

markdesign test
Moderator Tag

Recommended Posts

Hi, I am moving over from using BulkLoader to LoaderMax for loading external font swf.

 

The font swf would have this code that would generate the swf with the font embedded in it.

[Embed(source="font.otf", fontName="font", mimeType="application/x-font")]
var font:Class;
Font.registerFont(font);

 

Using BulkLoader, this is all I did and the fonts would display correctly

var loader:BulkLoader = new BulkLoader("main-site");
loader.addEventListener(BulkLoader.COMPLETE, onComplete);
loader.add("font.swf");
loader.start();

 

Using LoaderMax the loaded font is not displaying:

loader = new LoaderMax({name:"mainQueue", onComplete:completeHander,});
loader.append(new SWFLoader("font.swf"));
loader.load();

 

Thank you,

~mark

Link to comment
Share on other sites

Several comments/questions:

 

1) You had a typo in your code - a comma after completeHandler.

 

2) Are you absolutely positive that the ONLY difference between your working BulkLoader version and the broken LoaderMax version is the loader that you used? Can you please post two FLAs - one with BulkLoader and one with LoaderMax that demonstrates that the one works while the other doesn't? I wonder if there's another factor at play here.

 

3) Are you loading the swf from another domain?

 

4) Is the swf loading at all? Any errors?

 

For the record, I have heard from several developers who are using LoaderMax to load fonts like this and it worked great for them. I'm pretty sure the problem isn't in LoaderMax, but I could be wrong.

Link to comment
Share on other sites

:idea:

Ah!!

 

I was putting together two example FLA to post when i stumbled upon the difference.

The error was in my CSSLoader.

 

I didn't realize your CSSLoader also parses it for you.

So when using LoaderMax it was not necessary for me to do:

var css:StyleSheet = new StyleSheet();
css.parseCSS(loader.getContent("myCSS"));
textField.styleSheet = css;

 

All I had to do was:

textField.stylesheet = loader.getContent("myCSS");

 

Thank you for all your help!!

~mark

:oops:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...